From 23c20b345d5cf241e07889cd2f0fbf7f2bb302a6 Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Fri, 17 Sep 2010 22:02:37 +0000
Subject: [PATCH] Improvements to sub-entry security model: remove absolute subtree specification
---
opendj-sdk/opends/src/server/org/opends/server/schema/SubtreeSpecificationSyntax.java | 11 --
/dev/null | 164 -----------------------------------------
opendj-sdk/opends/src/server/org/opends/server/types/SubEntry.java | 12 ---
opendj-sdk/opends/src/server/org/opends/server/schema/SchemaConstants.java | 24 ------
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/SubentryManagerTestCase.java | 29 -------
5 files changed, 0 insertions(+), 240 deletions(-)
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/AbsoluteSubtreeSpecification.java b/opendj-sdk/opends/src/server/org/opends/server/core/AbsoluteSubtreeSpecification.java
deleted file mode 100644
index 1e330c2..0000000
--- a/opendj-sdk/opends/src/server/org/opends/server/core/AbsoluteSubtreeSpecification.java
+++ /dev/null
@@ -1,408 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Copyright 2006-2010 Sun Microsystems, Inc.
- */
-package org.opends.server.core;
-import org.opends.messages.Message;
-
-import static org.opends.messages.SchemaMessages.*;
-
-import java.util.HashSet;
-import java.util.InputMismatchException;
-import java.util.NoSuchElementException;
-
-import org.opends.server.types.DirectoryException;
-import org.opends.server.types.DN;
-import org.opends.server.types.Entry;
-import org.opends.server.types.ResultCode;
-import org.opends.server.types.SearchFilter;
-import org.opends.server.util.StaticUtils;
-
-/**
- * An absolute subtree specification.
- * <p>
- * Absolute subtree specifications are based on RFC 3672 subtree
- * specifications but have the following differences:
- * <ul>
- * <li>the scope of the subtree specification is not related to the
- * location of the entry containing the subtree specification
- * <li>the scope of the subtree specification is defined by the
- * absolute base DN
- * <li>the specification filter is not a set of refinements, but an
- * LDAP search filter.
- * </ul>
- * <p>
- * The string representation of an absolute subtree specification is
- * defined by the following grammar:
- *
- * <pre>
- * SubtreeSpecification = "{" sp ss-absolute-base
- * [ sep sp ss-specificExclusions ]
- * [ sep sp ss-minimum ]
- * [ sep sp ss-maximum ]
- * [ sep sp ss-specificationFilter ]
- * sp "}"
- *
- * ss-absolute-base = "absoluteBase&quot msp DistinguishedName
- *
- * ss-specificExclusions = "specificExclusions&quot
- * msp SpecificExclusions
- *
- * ss-minimum = "minimum&quot msp BaseDistance
- *
- * ss-maximum = "maximum&quot msp BaseDistance
- *
- * ss-specificationFilter = "specificationFilter&quot msp Filter
- *
- * SpecificExclusions = "{"
- * [ sp SpecificExclusion
- * ( "," sp SpecificExclusion ) ]
- * sp "}"
- *
- * SpecificExclusion = chopBefore / chopAfter
- *
- * chopBefore = "chopBefore&quot ":" LocalName
- *
- * chopAfter = "chopAfter&quot ":" LocalName
- *
- * Filter = dquote *SafeUTF8Character dquote
- * </pre>
- */
-public final class AbsoluteSubtreeSpecification extends
- SimpleSubtreeSpecification {
-
- // The optional search filter.
- private SearchFilter filter;
-
- /**
- * Parses the string argument as an absolute subtree specification.
- * <p>
- * The parser is very lenient regarding the ordering of the various
- * subtree specification fields. However, it will not except multiple
- * occurrances of a particular field.
- *
- * @param s
- * The string to be parsed.
- * @return The absolute subtree specification represented by the
- * string argument.
- * @throws DirectoryException
- * If the string does not contain a parsable absolute
- * subtree specification.
- */
- public static AbsoluteSubtreeSpecification valueOf(String s)
- throws DirectoryException {
-
- // Default values.
- DN absoluteBaseDN = null;
-
- int minimum = -1;
- int maximum = -1;
-
- HashSet<DN> chopBefore = new HashSet<DN>();
- HashSet<DN> chopAfter = new HashSet<DN>();
-
- SearchFilter filter = null;
-
- // Value must have an opening left brace.
- Parser parser = new Parser(s);
- boolean isValid = true;
-
- try {
- parser.skipLeftBrace();
-
- // Parse each element of the value sequence.
- boolean isFirst = true;
-
- while (true) {
- if (parser.hasNextRightBrace()) {
- // Make sure that there is a closing brace and no trailing
- // text.
- parser.skipRightBrace();
-
- if (parser.hasNext()) {
- throw new java.util.InputMismatchException();
- }
- break;
- }
-
- // Make sure that there is a comma separator if this is not the
- // first element.
- if (!isFirst) {
- parser.skipSeparator();
- } else {
- isFirst = false;
- }
-
- String key = parser.nextKey();
- if (key.equals("absolutebase")) {
- if (absoluteBaseDN != null) {
- // Absolute base DN specified more than once.
- throw new InputMismatchException();
- }
- absoluteBaseDN = DN.decode(parser.nextStringValue());
- } else if (key.equals("minimum")) {
- if (minimum != -1) {
- // Minimum specified more than once.
- throw new InputMismatchException();
- }
- minimum = parser.nextInt();
- } else if (key.equals("maximum")) {
- if (maximum != -1) {
- // Maximum specified more than once.
- throw new InputMismatchException();
- }
- maximum = parser.nextInt();
- } else if (key.equals("specificationfilter")) {
- if (filter != null) {
- // Filter specified more than once.
- throw new InputMismatchException();
- }
- filter = SearchFilter.createFilterFromString(parser
- .nextStringValue());
- } else if (key.equals("specificexclusions")) {
- if (!chopBefore.isEmpty() || !chopAfter.isEmpty()) {
- // Specific exclusions specified more than once.
- throw new InputMismatchException();
- }
-
- parser.nextSpecificExclusions(chopBefore, chopAfter);
- } else {
- throw new InputMismatchException();
- }
- }
-
- // Must have an absolute base DN.
- if (absoluteBaseDN == null) {
- isValid = false;
- }
-
- // Make default minimum value is 0.
- if (minimum < 0) {
- minimum = 0;
- }
-
- // Check that the maximum, if specified, is gte the minimum.
- if (maximum >= 0 && maximum < minimum) {
- isValid = false;
- }
- } catch (InputMismatchException e) {
- isValid = false;
- } catch (NoSuchElementException e) {
- isValid = false;
- }
-
- if (isValid) {
- return new AbsoluteSubtreeSpecification(absoluteBaseDN, minimum,
- maximum, chopBefore, chopAfter, filter);
- } else {
- Message message =
- ERR_ATTR_SYNTAX_ABSOLUTE_SUBTREE_SPECIFICATION_INVALID.get(s);
- throw new DirectoryException(ResultCode.INVALID_ATTRIBUTE_SYNTAX,
- message);
- }
- }
-
- /**
- * Create a new absolute subtree specification.
- *
- * @param absoluteBaseDN
- * The absolute base DN of the subtree.
- * @param minimumDepth
- * The minimum depth (<=0 means unlimited).
- * @param maximumDepth
- * The maximum depth (<0 means unlimited).
- * @param chopBefore
- * The set of chop before local names (relative to the base
- * DN), or <code>null</code> if there are none.
- * @param chopAfter
- * The set of chop after local names (relative to the base
- * DN), or <code>null</code> if there are none.
- * @param filter
- * The optional search filter (<code>null</code> if there
- * is no filter).
- */
- public AbsoluteSubtreeSpecification(DN absoluteBaseDN, int minimumDepth,
- int maximumDepth, Iterable<DN> chopBefore, Iterable<DN> chopAfter,
- SearchFilter filter) {
- super(absoluteBaseDN, minimumDepth, maximumDepth, chopBefore, chopAfter);
-
-
- this.filter = filter;
- }
-
- /**
- * Get the absolute base DN.
- *
- * @return Returns the absolute base DN.
- */
- public DN getAbsoluteBaseDN() {
- return getBaseDN();
- }
-
- /**
- * Get the specification filter.
- *
- * @return Returns the search filter, or <code>null</code> if there
- * is no filter.
- */
- public SearchFilter getFilter() {
- return filter;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isWithinScope(Entry entry) {
-
- if (isDNWithinScope(entry.getDN())) {
- if (filter != null) {
- try {
- return filter.matchesEntry(entry);
- } catch (DirectoryException e) {
- // TODO: need to decide what to do with the exception here. It's
- // probably safe to ignore, but we could log it perhaps.
- return false;
- }
- }
- return true;
- } else {
- return false;
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public StringBuilder toString(StringBuilder builder) {
-
- builder.append("{ absoluteBase ");
- StaticUtils.toRFC3641StringValue(builder, getBaseDN().toString());
-
- Iterable<DN> chopBefore = getChopBefore();
- Iterable<DN> chopAfter = getChopAfter();
-
- if ((chopBefore != null && chopBefore.iterator().hasNext())
- || (chopAfter != null && chopAfter.iterator().hasNext())) {
- builder.append(", specificExclusions { ");
-
- boolean isFirst = true;
-
- if (chopBefore != null) {
- for (DN dn : chopBefore) {
- if (!isFirst) {
- builder.append(", chopBefore:");
- } else {
- builder.append("chopBefore:");
- isFirst = false;
- }
- StaticUtils.toRFC3641StringValue(builder, dn.toString());
- }
- }
-
- if (chopAfter != null) {
- for (DN dn : chopAfter) {
- if (!isFirst) {
- builder.append(", chopAfter:");
- } else {
- builder.append("chopAfter:");
- isFirst = false;
- }
- StaticUtils.toRFC3641StringValue(builder, dn.toString());
- }
- }
-
- builder.append(" }");
- }
-
- if (getMinimumDepth() > 0) {
- builder.append(", minimum ");
- builder.append(getMinimumDepth());
- }
-
- if (getMaximumDepth() >= 0) {
- builder.append(", maximum ");
- builder.append(getMaximumDepth());
- }
-
- if (filter != null) {
- builder.append(", specificationFilter ");
- StaticUtils.toRFC3641StringValue(builder, filter.toString());
- }
-
- builder.append(" }");
-
- return builder;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean equals(Object obj) {
-
- if (this == obj) {
- return true;
- }
-
- if (obj instanceof AbsoluteSubtreeSpecification) {
- AbsoluteSubtreeSpecification other = (AbsoluteSubtreeSpecification) obj;
-
- if (!commonComponentsEquals(other)) {
- return false;
- }
-
- if (!getBaseDN().equals(other.getBaseDN())) {
- return false;
- }
-
- if (filter != null) {
- return filter.equals(other.filter);
- } else {
- return filter == other.filter;
- }
- }
-
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int hashCode() {
-
- int hash = commonComponentsHashCode();
-
- hash = hash * 31 + getBaseDN().hashCode();
-
- if (filter != null) {
- hash = hash * 31 + filter.hashCode();
- }
-
- return hash;
- }
-}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/AbsoluteSubtreeSpecificationSyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/AbsoluteSubtreeSpecificationSyntax.java
deleted file mode 100644
index 0d47c20..0000000
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/AbsoluteSubtreeSpecificationSyntax.java
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Copyright 2006-2008 Sun Microsystems, Inc.
- */
-package org.opends.server.schema;
-
-import static org.opends.server.loggers.ErrorLogger.logError;
-import static org.opends.server.loggers.debug.DebugLogger.*;
-import org.opends.server.loggers.debug.DebugTracer;
-import static org.opends.messages.SchemaMessages.*;
-import org.opends.messages.MessageBuilder;
-import static org.opends.server.schema.SchemaConstants.*;
-
-import org.opends.server.admin.std.server.AttributeSyntaxCfg;
-import org.opends.server.api.ApproximateMatchingRule;
-import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.AttributeValueDecoder;
-import org.opends.server.api.EqualityMatchingRule;
-import org.opends.server.api.OrderingMatchingRule;
-import org.opends.server.api.SubstringMatchingRule;
-import org.opends.server.config.ConfigException;
-import org.opends.server.core.AbsoluteSubtreeSpecification;
-import org.opends.server.core.DirectoryServer;
-import org.opends.server.types.*;
-
-
-/**
- * This class defines the absolute subtree specification attribute
- * syntax, which is used to select sets of entries in dynamic groups and
- * access control rules.
- */
-public final class AbsoluteSubtreeSpecificationSyntax
- extends AttributeSyntax<AttributeSyntaxCfg>
-{
- /**
- * The tracer object for the debug logger.
- */
- private static final DebugTracer TRACER = getTracer();
-
- // The default equality matching rule for this syntax.
- private EqualityMatchingRule defaultEqualityMatchingRule;
-
- // The default ordering matching rule for this syntax.
- private OrderingMatchingRule defaultOrderingMatchingRule;
-
- // The default substring matching rule for this syntax.
- private SubstringMatchingRule defaultSubstringMatchingRule;
-
- /**
- * An {@link AbsoluteSubtreeSpecification} attribute value decoder for
- * this syntax.
- */
- public static final AttributeValueDecoder<AbsoluteSubtreeSpecification>
- DECODER = new AttributeValueDecoder<AbsoluteSubtreeSpecification>() {
- /**
- * {@inheritDoc}
- */
- public AbsoluteSubtreeSpecification decode(AttributeValue value)
- throws DirectoryException {
- return AbsoluteSubtreeSpecification.valueOf(value.getValue().toString());
- }
- };
-
- /**
- * Creates a new instance of this syntax. Note that the only thing
- * that should be done here is to invoke the default constructor for
- * the superclass. All initialization should be performed in the
- * <CODE>initializeSyntax</CODE> method.
- */
- public AbsoluteSubtreeSpecificationSyntax() {
- // No implementation required.
- }
-
- /**
- * {@inheritDoc}
- */
- public void initializeSyntax(AttributeSyntaxCfg configuration)
- throws ConfigException {
-
- defaultEqualityMatchingRule = DirectoryServer
- .getEqualityMatchingRule(EMR_OCTET_STRING_OID);
- if (defaultEqualityMatchingRule == null) {
- logError(ERR_ATTR_SYNTAX_UNKNOWN_EQUALITY_MATCHING_RULE.get(
- EMR_OCTET_STRING_OID, SYNTAX_ABSOLUTE_SUBTREE_SPECIFICATION_NAME));
- }
-
- defaultOrderingMatchingRule = DirectoryServer
- .getOrderingMatchingRule(OMR_OCTET_STRING_OID);
- if (defaultOrderingMatchingRule == null) {
- logError(ERR_ATTR_SYNTAX_UNKNOWN_ORDERING_MATCHING_RULE.get(
- OMR_OCTET_STRING_OID, SYNTAX_ABSOLUTE_SUBTREE_SPECIFICATION_NAME));
- }
-
- defaultSubstringMatchingRule = DirectoryServer
- .getSubstringMatchingRule(SMR_OCTET_STRING_OID);
- if (defaultSubstringMatchingRule == null) {
- logError(ERR_ATTR_SYNTAX_UNKNOWN_SUBSTRING_MATCHING_RULE.get(
- SMR_OCTET_STRING_OID, SYNTAX_ABSOLUTE_SUBTREE_SPECIFICATION_NAME));
- }
- }
-
- /**
- * Retrieves the common name for this attribute syntax.
- *
- * @return The common name for this attribute syntax.
- */
- public String getSyntaxName() {
-
- return SYNTAX_ABSOLUTE_SUBTREE_SPECIFICATION_NAME;
- }
-
- /**
- * Retrieves the OID for this attribute syntax.
- *
- * @return The OID for this attribute syntax.
- */
- public String getOID() {
-
- return SYNTAX_ABSOLUTE_SUBTREE_SPECIFICATION_OID;
- }
-
- /**
- * Retrieves a description for this attribute syntax.
- *
- * @return A description for this attribute syntax.
- */
- public String getDescription() {
-
- return SYNTAX_ABSOLUTE_SUBTREE_SPECIFICATION_DESCRIPTION;
- }
-
- /**
- * Retrieves the default equality matching rule that will be used for
- * attributes with this syntax.
- *
- * @return The default equality matching rule that will be used for
- * attributes with this syntax, or <CODE>null</CODE> if
- * equality matches will not be allowed for this type by
- * default.
- */
- public EqualityMatchingRule getEqualityMatchingRule() {
-
- return defaultEqualityMatchingRule;
- }
-
- /**
- * Retrieves the default ordering matching rule that will be used for
- * attributes with this syntax.
- *
- * @return The default ordering matching rule that will be used for
- * attributes with this syntax, or <CODE>null</CODE> if
- * ordering matches will not be allowed for this type by
- * default.
- */
- public OrderingMatchingRule getOrderingMatchingRule() {
-
- return defaultOrderingMatchingRule;
- }
-
- /**
- * Retrieves the default substring matching rule that will be used for
- * attributes with this syntax.
- *
- * @return The default substring matching rule that will be used for
- * attributes with this syntax, or <CODE>null</CODE> if
- * substring matches will not be allowed for this type by
- * default.
- */
- public SubstringMatchingRule getSubstringMatchingRule() {
-
- return defaultSubstringMatchingRule;
- }
-
- /**
- * Retrieves the default approximate matching rule that will be used
- * for attributes with this syntax.
- *
- * @return The default approximate matching rule that will be used for
- * attributes with this syntax, or <CODE>null</CODE> if
- * approximate matches will not be allowed for this type by
- * default.
- */
- public ApproximateMatchingRule getApproximateMatchingRule() {
-
- // There is no approximate matching rule by default.
- return null;
- }
-
- /**
- * Indicates whether the provided value is acceptable for use in an
- * attribute with this syntax. If it is not, then the reason may be
- * appended to the provided buffer.
- *
- * @param value
- * The value for which to make the determination.
- * @param invalidReason
- * The buffer to which the invalid reason should be appended.
- * @return <CODE>true</CODE> if the provided value is acceptable for
- * use with this syntax, or <CODE>false</CODE> if not.
- */
- public boolean valueIsAcceptable(ByteSequence value,
- MessageBuilder invalidReason)
- {
- // Use the subtree specification code to make this determination.
- try {
- AbsoluteSubtreeSpecification.valueOf(value.toString());
-
- return true;
- } catch (DirectoryException e) {
- if (debugEnabled())
- {
- TRACER.debugCaught(DebugLogLevel.ERROR, e);
- }
-
- invalidReason.append(e.getMessageObject());
- return false;
- }
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public boolean isBinary()
- {
- return false;
- }
-}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/SchemaConstants.java b/opendj-sdk/opends/src/server/org/opends/server/schema/SchemaConstants.java
index 727952f..ad1987f 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/SchemaConstants.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/SchemaConstants.java
@@ -1692,30 +1692,6 @@
/**
- * The OID for the absolute subtree specification attribute syntax.
- */
- public static final String SYNTAX_ABSOLUTE_SUBTREE_SPECIFICATION_OID =
- SYNTAX_SUBTREE_SPECIFICATION_OID;
-
-
-
- /**
- * The description for the absolute subtree specification attribute syntax.
- */
- public static final String SYNTAX_ABSOLUTE_SUBTREE_SPECIFICATION_DESCRIPTION =
- "Absolute Subtree Specification";
-
-
-
- /**
- * The name for the absolute subtree specification attribute syntax.
- */
- public static final String SYNTAX_ABSOLUTE_SUBTREE_SPECIFICATION_NAME =
- SYNTAX_SUBTREE_SPECIFICATION_NAME;
-
-
-
- /**
* The OID for the relative subtree specification attribute syntax.
*/
public static final String SYNTAX_RELATIVE_SUBTREE_SPECIFICATION_OID =
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/SubtreeSpecificationSyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/SubtreeSpecificationSyntax.java
index 7e4b494..b747ba6 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/SubtreeSpecificationSyntax.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/SubtreeSpecificationSyntax.java
@@ -43,7 +43,6 @@
import org.opends.server.api.SubstringMatchingRule;
import org.opends.server.api.SubtreeSpecification;
import org.opends.server.config.ConfigException;
-import org.opends.server.core.AbsoluteSubtreeSpecification;
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.RFC3672SubtreeSpecification;
import org.opends.server.core.RelativeSubtreeSpecification;
@@ -122,11 +121,6 @@
rootDN, specString);
return subTreeSpec;
} catch (DirectoryException de) {}
- try {
- subTreeSpec = AbsoluteSubtreeSpecification.valueOf(
- specString);
- return subTreeSpec;
- } catch (DirectoryException de) {}
if (subTreeSpec == null) {
Message message =
@@ -294,11 +288,6 @@
DN.nullDN(), specString);
return true;
} catch (DirectoryException de) {}
- try {
- subTreeSpec = AbsoluteSubtreeSpecification.valueOf(
- specString);
- return true;
- } catch (DirectoryException de) {}
if (subTreeSpec == null) {
Message message =
diff --git a/opendj-sdk/opends/src/server/org/opends/server/types/SubEntry.java b/opendj-sdk/opends/src/server/org/opends/server/types/SubEntry.java
index 4d13e2e..4e529b4 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/types/SubEntry.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/types/SubEntry.java
@@ -28,7 +28,6 @@
package org.opends.server.types;
import org.opends.messages.Message;
-import org.opends.server.core.AbsoluteSubtreeSpecification;
import org.opends.server.core.RelativeSubtreeSpecification;
import org.opends.server.api.SubtreeSpecification;
import java.util.List;
@@ -247,17 +246,6 @@
{
break;
}
- try
- {
- this.subTreeSpec = AbsoluteSubtreeSpecification.valueOf(
- specString);
- isValidSpec = true;
- }
- catch (DirectoryException de)
- {
- isValidSpec = false;
- }
- break;
}
if (this.subTreeSpec != null)
{
diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/SubentryManagerTestCase.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/SubentryManagerTestCase.java
index 8fb68e4..5cbe963 100644
--- a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/SubentryManagerTestCase.java
+++ b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/SubentryManagerTestCase.java
@@ -569,35 +569,6 @@
// Remove Relative Spec test subentry.
TestCaseUtils.deleteEntry(relativeSubentry.getDN());
-
- // Add Absolute Spec test subentry.
- Entry absoluteSubentry = TestCaseUtils.makeEntry(
- "dn: cn=Absolute Subentry," + SUFFIX,
- "objectClass: top",
- "objectclass: subentry",
- "subtreeSpecification: {absoluteBase \"ou=Test SubEntry Manager\"}",
- "cn: Subentry");
- addOperation =
- connection.processAdd(absoluteSubentry.getDN(),
- absoluteSubentry.getObjectClasses(),
- absoluteSubentry.getUserAttributes(),
- absoluteSubentry.getOperationalAttributes());
- assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
- assertNotNull(DirectoryServer.getEntry(absoluteSubentry.getDN()));
-
- List<SubEntry> absoluteSubList =
- DirectoryServer.getSubentryManager().getSubentries();
- for (SubEntry subentry : absoluteSubList)
- {
- if (subentry.getDN().equals(absoluteSubentry.getDN()))
- {
- SubtreeSpecification spec = subentry.getSubTreeSpecification();
- assertTrue(spec instanceof AbsoluteSubtreeSpecification);
- }
- }
-
- // Remove Absolute Spec test subentry.
- TestCaseUtils.deleteEntry(absoluteSubentry.getDN());
}
private void addTestEntries() throws Exception
diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/TestAbsoluteSubtreeSpecification.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/TestAbsoluteSubtreeSpecification.java
deleted file mode 100644
index 27f2b21..0000000
--- a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/TestAbsoluteSubtreeSpecification.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Copyright 2006-2008 Sun Microsystems, Inc.
- */
-package org.opends.server.core;
-
-import static org.testng.AssertJUnit.assertEquals;
-
-import org.opends.server.api.SubtreeSpecification;
-import org.opends.server.types.DirectoryException;
-import org.opends.server.types.DN;
-import org.testng.annotations.Test;
-
-/**
- * This class defines a set of tests for the
- * {@link org.opends.server.core.AbsoluteSubtreeSpecification} class.
- * <p>
- * This test suite is shorter than the RFC 3672 test suite because it
- * focuses on testing only the pieces of functionality that are specific
- * to the syntax.
- */
-public final class TestAbsoluteSubtreeSpecification extends
- SubtreeSpecificationTestCase {
-
- /**
- * Tests the {@link AbsoluteSubtreeSpecification#valueOf(String)}
- * method.
- *
- * @throws Exception
- * If the test failed unexpectedly.
- */
- @Test(expectedExceptions = DirectoryException.class)
- public void testValueOf1() throws Exception {
- String input = "{}";
-
- AbsoluteSubtreeSpecification.valueOf(input);
- }
-
- /**
- * Tests the {@link AbsoluteSubtreeSpecification#valueOf(String)}
- * method.
- *
- * @throws Exception
- * If the test failed unexpectedly.
- */
- @Test(expectedExceptions = DirectoryException.class)
- public void testValueOf2() throws Exception {
- String input = " { } ";
-
- AbsoluteSubtreeSpecification.valueOf(input);
- }
-
- /**
- * Tests the {@link AbsoluteSubtreeSpecification#valueOf(String)}
- * method.
- *
- * @throws Exception
- * If the test failed unexpectedly.
- */
- @Test
- public void testValueOf3() throws Exception {
- String input = "{ absoluteBase \"dc=sun, dc=com\" }";
- String output = "{ absoluteBase \"dc=sun,dc=com\" }";
-
- SubtreeSpecification ss = AbsoluteSubtreeSpecification.valueOf(input);
- assertEquals(output, ss.toString());
- }
-
- /**
- * Tests the {@link AbsoluteSubtreeSpecification#valueOf(String)}
- * method.
- *
- * @throws Exception
- * If the test failed unexpectedly.
- */
- @Test
- public void testValueOf4() throws Exception {
-
- String input = "{absoluteBase \"dc=sun, dc=com\"}";
- String output = "{ absoluteBase \"dc=sun,dc=com\" }";
-
- SubtreeSpecification ss = AbsoluteSubtreeSpecification.valueOf(input);
- assertEquals(output, ss.toString());
- }
-
- /**
- * Tests the {@link AbsoluteSubtreeSpecification#valueOf(String)}
- * method.
- *
- * @throws Exception
- * If the test failed unexpectedly.
- */
- @Test
- public void testValueOf5() throws Exception {
-
- String input = "{ absoluteBase \"dc=sun, dc=com\", "
- + "specificationFilter \"(objectClass=*)\" }";
- String output = "{ absoluteBase \"dc=sun,dc=com\", "
- + "specificationFilter \"(objectClass=*)\" }";
-
- SubtreeSpecification ss = AbsoluteSubtreeSpecification.valueOf(input);
- assertEquals(output, ss.toString());
- }
-
- /**
- * Tests the {@link AbsoluteSubtreeSpecification#isWithinScope(Entry)}
- * method.
- *
- * @throws Exception
- * If the test failed unexpectedly.
- */
- @Test
- public void testMatches1() throws Exception {
- DN dn = DN.decode("dc=abc, dc=sun, dc=com");
-
- String value = "{ absoluteBase \"dc=sun, dc=com\", "
- + "specificationFilter \"(objectClass=person)\" }";
- SubtreeSpecification ss = AbsoluteSubtreeSpecification.valueOf(value);
-
- assertEquals(true, ss
- .isWithinScope(createEntry(dn, getObjectClasses())));
- }
-
- /**
- * Tests the {@link AbsoluteSubtreeSpecification#isWithinScope(Entry)}
- * method.
- *
- * @throws Exception
- * If the test failed unexpectedly.
- */
- @Test
- public void testMatches2() throws Exception {
- DN dn = DN.decode("dc=abc, dc=sun, dc=com");
-
- String value = "{ absoluteBase \"dc=sun, dc=com\", "
- + "specificationFilter \"(objectClass=organization)\" }";
- SubtreeSpecification ss = AbsoluteSubtreeSpecification.valueOf(value);
-
- assertEquals(false, ss
- .isWithinScope(createEntry(dn, getObjectClasses())));
- }
-}
--
Gitblit v1.10.0