From fd650a8fd632005824a2e64d78549992ee9ffda0 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 14 Feb 2014 13:15:52 +0000
Subject: [PATCH] OPENDJ-1308 Migrate schema support
---
opendj3-server-dev/src/server/org/opends/server/schema/UserPasswordEqualityMatchingRule.java | 14 -
opendj3-server-dev/src/server/org/opends/server/backends/jeb/Index.java | 10 -
opendj3-server-dev/src/server/org/opends/server/schema/CollationMatchingRuleFactory.java | 49 -------
opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/util/ReadOnlyConfigFileHandler.java | 19 +--
opendj3-server-dev/src/server/org/opends/server/backends/MonitorBackend.java | 17 --
opendj3-server-dev/src/server/org/opends/server/core/PasswordPolicyState.java | 35 +----
opendj3-server-dev/src/server/org/opends/server/extensions/ConfigFileHandler.java | 13 -
opendj3-server-dev/src/server/org/opends/server/backends/task/TaskBackend.java | 9 -
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/schema/TimeBasedMatchingRuleTest.java | 3
opendj3-server-dev/src/server/org/opends/server/types/SearchFilter.java | 27 +---
opendj3-server-dev/src/server/org/opends/server/backends/BackupBackend.java | 9 -
opendj3-server-dev/src/server/org/opends/server/backends/jeb/BackendImpl.java | 9 -
opendj3-server-dev/src/server/org/opends/server/backends/MemoryBackend.java | 15 -
opendj3-server-dev/src/server/org/opends/server/schema/AuthPasswordEqualityMatchingRule.java | 13 -
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/schema/EqualityMatchingRuleTest.java | 8 -
opendj3-server-dev/src/server/org/opends/server/api/ApproximateMatchingRule.java | 15 --
opendj3-server-dev/src/server/org/opends/server/api/EqualityMatchingRule.java | 9 -
opendj3-server-dev/src/server/org/opends/server/schema/TimeBasedMatchingRuleFactory.java | 55 +-------
opendj3-server-dev/src/server/org/opends/server/backends/RootDSEBackend.java | 9 -
19 files changed, 67 insertions(+), 271 deletions(-)
diff --git a/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/util/ReadOnlyConfigFileHandler.java b/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/util/ReadOnlyConfigFileHandler.java
index 88850d5..718c2b9 100644
--- a/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/util/ReadOnlyConfigFileHandler.java
+++ b/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/util/ReadOnlyConfigFileHandler.java
@@ -26,14 +26,13 @@
*/
package org.opends.guitools.controlpanel.util;
-import static org.opends.messages.ConfigMessages.*;
-
import java.io.File;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.opendj.ldap.ConditionResult;
import org.opends.server.admin.Configuration;
import org.opends.server.api.ConfigHandler;
import org.opends.server.config.ConfigEntry;
@@ -48,7 +47,6 @@
import org.opends.server.types.BackupConfig;
import org.opends.server.types.BackupDirectory;
import org.opends.server.types.CanceledOperationException;
-import org.forgerock.opendj.ldap.ConditionResult;
import org.opends.server.types.DN;
import org.opends.server.types.DirectoryEnvironmentConfig;
import org.opends.server.types.DirectoryException;
@@ -63,6 +61,8 @@
import org.opends.server.util.LDIFReader;
import org.opends.server.util.StaticUtils;
+import static org.opends.messages.ConfigMessages.*;
+
/**
* A class used to read the configuration from a file. This config file
* handler does not allow to modify the configuration, only to read it.
@@ -384,18 +384,11 @@
public ConditionResult hasSubordinates(DN entryDN) throws DirectoryException
{
ConfigEntry baseEntry = configEntries.get(entryDN);
- if(baseEntry == null)
+ if (baseEntry != null)
{
- return ConditionResult.UNDEFINED;
+ return ConditionResult.valueOf(baseEntry.hasChildren());
}
- else if(baseEntry.hasChildren())
- {
- return ConditionResult.TRUE;
- }
- else
- {
- return ConditionResult.FALSE;
- }
+ return ConditionResult.UNDEFINED;
}
/**
diff --git a/opendj3-server-dev/src/server/org/opends/server/api/ApproximateMatchingRule.java b/opendj3-server-dev/src/server/org/opends/server/api/ApproximateMatchingRule.java
index fd0094c..1c530a3 100644
--- a/opendj3-server-dev/src/server/org/opends/server/api/ApproximateMatchingRule.java
+++ b/opendj3-server-dev/src/server/org/opends/server/api/ApproximateMatchingRule.java
@@ -26,11 +26,8 @@
*/
package org.opends.server.api;
-
-
-import org.forgerock.opendj.ldap.ConditionResult;
import org.forgerock.opendj.ldap.ByteSequence;
-
+import org.forgerock.opendj.ldap.ConditionResult;
/**
* This class defines the set of methods and structures that must be
@@ -86,14 +83,8 @@
public ConditionResult valuesMatch(ByteSequence attributeValue,
ByteSequence assertionValue)
{
- if (approximatelyMatch(attributeValue, assertionValue))
- {
- return ConditionResult.TRUE;
- }
- else
- {
- return ConditionResult.FALSE;
- }
+ return ConditionResult.valueOf(
+ approximatelyMatch(attributeValue, assertionValue));
}
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/api/EqualityMatchingRule.java b/opendj3-server-dev/src/server/org/opends/server/api/EqualityMatchingRule.java
index 753aca5..05a364e 100644
--- a/opendj3-server-dev/src/server/org/opends/server/api/EqualityMatchingRule.java
+++ b/opendj3-server-dev/src/server/org/opends/server/api/EqualityMatchingRule.java
@@ -82,14 +82,7 @@
public ConditionResult valuesMatch(ByteSequence attributeValue,
ByteSequence assertionValue)
{
- if (areEqual(attributeValue, assertionValue))
- {
- return ConditionResult.TRUE;
- }
- else
- {
- return ConditionResult.FALSE;
- }
+ return ConditionResult.valueOf(areEqual(attributeValue, assertionValue));
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/backends/BackupBackend.java b/opendj3-server-dev/src/server/org/opends/server/backends/BackupBackend.java
index b175805..b2e28c9 100644
--- a/opendj3-server-dev/src/server/org/opends/server/backends/BackupBackend.java
+++ b/opendj3-server-dev/src/server/org/opends/server/backends/BackupBackend.java
@@ -321,14 +321,7 @@
{
return ConditionResult.UNDEFINED;
}
- else if(ret == 0)
- {
- return ConditionResult.FALSE;
- }
- else
- {
- return ConditionResult.TRUE;
- }
+ return ConditionResult.valueOf(ret != 0);
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/backends/MemoryBackend.java b/opendj3-server-dev/src/server/org/opends/server/backends/MemoryBackend.java
index aeda39f..a2ec742 100644
--- a/opendj3-server-dev/src/server/org/opends/server/backends/MemoryBackend.java
+++ b/opendj3-server-dev/src/server/org/opends/server/backends/MemoryBackend.java
@@ -35,6 +35,9 @@
import java.util.Set;
import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.i18n.slf4j.LocalizedLogger;
+import org.forgerock.opendj.ldap.ConditionResult;
+import org.forgerock.util.Reject;
import org.opends.server.admin.Configuration;
import org.opends.server.admin.std.server.MemoryBackendCfg;
import org.opends.server.api.Backend;
@@ -46,11 +49,9 @@
import org.opends.server.core.ModifyOperation;
import org.opends.server.core.ModifyDNOperation;
import org.opends.server.core.SearchOperation;
-import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.opends.server.types.AttributeType;
import org.opends.server.types.BackupConfig;
import org.opends.server.types.BackupDirectory;
-import org.forgerock.opendj.ldap.ConditionResult;
import org.opends.server.types.Control;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.DN;
@@ -67,7 +68,6 @@
import org.opends.server.util.LDIFException;
import org.opends.server.util.LDIFReader;
import org.opends.server.util.LDIFWriter;
-import org.forgerock.util.Reject;
import static org.opends.messages.BackendMessages.*;
import static org.opends.server.util.ServerConstants.*;
@@ -318,14 +318,7 @@
{
return ConditionResult.UNDEFINED;
}
- else if(ret == 0)
- {
- return ConditionResult.FALSE;
- }
- else
- {
- return ConditionResult.TRUE;
- }
+ return ConditionResult.valueOf(ret != 0);
}
/**
diff --git a/opendj3-server-dev/src/server/org/opends/server/backends/MonitorBackend.java b/opendj3-server-dev/src/server/org/opends/server/backends/MonitorBackend.java
index fcaf1ab..eec028f 100644
--- a/opendj3-server-dev/src/server/org/opends/server/backends/MonitorBackend.java
+++ b/opendj3-server-dev/src/server/org/opends/server/backends/MonitorBackend.java
@@ -496,22 +496,13 @@
throws DirectoryException
{
final NavigableMap<DN, MonitorProvider<?>> dit = getDIT();
- if (!dit.containsKey(entryDN))
- {
- return ConditionResult.UNDEFINED;
- }
- else
+ if (dit.containsKey(entryDN))
{
final DN nextDN = dit.higherKey(entryDN);
- if (nextDN == null || !nextDN.isDescendantOf(entryDN))
- {
- return ConditionResult.FALSE;
- }
- else
- {
- return ConditionResult.TRUE;
- }
+ return ConditionResult.valueOf(
+ nextDN != null && nextDN.isDescendantOf(entryDN));
}
+ return ConditionResult.UNDEFINED;
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/backends/RootDSEBackend.java b/opendj3-server-dev/src/server/org/opends/server/backends/RootDSEBackend.java
index dc1dee7..650e9a4 100644
--- a/opendj3-server-dev/src/server/org/opends/server/backends/RootDSEBackend.java
+++ b/opendj3-server-dev/src/server/org/opends/server/backends/RootDSEBackend.java
@@ -394,14 +394,7 @@
{
return ConditionResult.UNDEFINED;
}
- else if(ret == 0)
- {
- return ConditionResult.FALSE;
- }
- else
- {
- return ConditionResult.TRUE;
- }
+ return ConditionResult.valueOf(ret != 0);
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/backends/jeb/BackendImpl.java b/opendj3-server-dev/src/server/org/opends/server/backends/jeb/BackendImpl.java
index 2c02447..679edf8 100644
--- a/opendj3-server-dev/src/server/org/opends/server/backends/jeb/BackendImpl.java
+++ b/opendj3-server-dev/src/server/org/opends/server/backends/jeb/BackendImpl.java
@@ -525,14 +525,7 @@
{
return ConditionResult.UNDEFINED;
}
- else if(ret == 0)
- {
- return ConditionResult.FALSE;
- }
- else
- {
- return ConditionResult.TRUE;
- }
+ return ConditionResult.valueOf(ret != 0);
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/backends/jeb/Index.java b/opendj3-server-dev/src/server/org/opends/server/backends/jeb/Index.java
index 977c48c..c575ff2 100644
--- a/opendj3-server-dev/src/server/org/opends/server/backends/jeb/Index.java
+++ b/opendj3-server-dev/src/server/org/opends/server/backends/jeb/Index.java
@@ -931,19 +931,11 @@
{
EntryIDSet entryIDList =
new EntryIDSet(key.getData(), data.getData());
-
if (!entryIDList.isDefined())
{
return ConditionResult.UNDEFINED;
}
- else if (entryIDList.contains(entryID))
- {
- return ConditionResult.TRUE;
- }
- else
- {
- return ConditionResult.FALSE;
- }
+ return ConditionResult.valueOf(entryIDList.contains(entryID));
}
else
{
diff --git a/opendj3-server-dev/src/server/org/opends/server/backends/task/TaskBackend.java b/opendj3-server-dev/src/server/org/opends/server/backends/task/TaskBackend.java
index 34c888c..1d98e4f 100644
--- a/opendj3-server-dev/src/server/org/opends/server/backends/task/TaskBackend.java
+++ b/opendj3-server-dev/src/server/org/opends/server/backends/task/TaskBackend.java
@@ -376,14 +376,7 @@
{
return ConditionResult.UNDEFINED;
}
- else if(ret == 0)
- {
- return ConditionResult.FALSE;
- }
- else
- {
- return ConditionResult.TRUE;
- }
+ return ConditionResult.valueOf(ret != 0);
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/core/PasswordPolicyState.java b/opendj3-server-dev/src/server/org/opends/server/core/PasswordPolicyState.java
index 9427cec..10c31bb 100644
--- a/opendj3-server-dev/src/server/org/opends/server/core/PasswordPolicyState.java
+++ b/opendj3-server-dev/src/server/org/opends/server/core/PasswordPolicyState.java
@@ -1902,16 +1902,17 @@
*/
public boolean isPasswordExpired()
{
- if ((isPasswordExpired == null) ||
- (isPasswordExpired == ConditionResult.UNDEFINED))
- {
- getPasswordExpirationTime();
- }
-
+ refreshIfUndefined(isPasswordExpired);
return isPasswordExpired == ConditionResult.TRUE;
}
-
+ private void refreshIfUndefined(ConditionResult cond)
+ {
+ if (cond == null || cond == ConditionResult.UNDEFINED)
+ {
+ getPasswordExpirationTime();
+ }
+ }
/**
* Indicates whether the user's last password change was within the minimum
@@ -1986,12 +1987,7 @@
*/
public boolean mayUseGraceLogin()
{
- if ((mayUseGraceLogin == null) ||
- (mayUseGraceLogin == ConditionResult.UNDEFINED))
- {
- getPasswordExpirationTime();
- }
-
+ refreshIfUndefined(mayUseGraceLogin);
return mayUseGraceLogin == ConditionResult.TRUE;
}
@@ -2007,11 +2003,7 @@
*/
public boolean shouldWarn()
{
- if ((shouldWarn == null) || (shouldWarn == ConditionResult.UNDEFINED))
- {
- getPasswordExpirationTime();
- }
-
+ refreshIfUndefined(shouldWarn);
return shouldWarn == ConditionResult.TRUE;
}
@@ -2026,12 +2018,7 @@
*/
public boolean isFirstWarning()
{
- if ((isFirstWarning == null) ||
- (isFirstWarning == ConditionResult.UNDEFINED))
- {
- getPasswordExpirationTime();
- }
-
+ refreshIfUndefined(isFirstWarning);
return isFirstWarning == ConditionResult.TRUE;
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/extensions/ConfigFileHandler.java b/opendj3-server-dev/src/server/org/opends/server/extensions/ConfigFileHandler.java
index 1f27815..1a3fa1d 100644
--- a/opendj3-server-dev/src/server/org/opends/server/extensions/ConfigFileHandler.java
+++ b/opendj3-server-dev/src/server/org/opends/server/extensions/ConfigFileHandler.java
@@ -1011,18 +1011,11 @@
throws DirectoryException
{
ConfigEntry baseEntry = configEntries.get(entryDN);
- if(baseEntry == null)
+ if (baseEntry != null)
{
- return ConditionResult.UNDEFINED;
+ return ConditionResult.valueOf(baseEntry.hasChildren());
}
- else if(baseEntry.hasChildren())
- {
- return ConditionResult.TRUE;
- }
- else
- {
- return ConditionResult.FALSE;
- }
+ return ConditionResult.UNDEFINED;
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/AuthPasswordEqualityMatchingRule.java b/opendj3-server-dev/src/server/org/opends/server/schema/AuthPasswordEqualityMatchingRule.java
index e7e69df..b4db0d8 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/AuthPasswordEqualityMatchingRule.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/AuthPasswordEqualityMatchingRule.java
@@ -181,18 +181,11 @@
return ConditionResult.FALSE;
}
-
// We support the scheme, so make the determination.
- if (storageScheme.authPasswordMatches(assertionValue,
+ return ConditionResult.valueOf(
+ storageScheme.authPasswordMatches(assertionValue,
authPWComponents[1].toString(),
- authPWComponents[2].toString()))
- {
- return ConditionResult.TRUE;
- }
- else
- {
- return ConditionResult.FALSE;
- }
+ authPWComponents[2].toString()));
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/CollationMatchingRuleFactory.java b/opendj3-server-dev/src/server/org/opends/server/schema/CollationMatchingRuleFactory.java
index eeba88f..ad9d6ab 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/CollationMatchingRuleFactory.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/CollationMatchingRuleFactory.java
@@ -875,14 +875,7 @@
public ConditionResult valuesMatch(ByteSequence attributeValue,
ByteSequence assertionValue)
{
- if (assertionValue.equals(attributeValue))
- {
- return ConditionResult.TRUE;
- }
- else
- {
- return ConditionResult.FALSE;
- }
+ return ConditionResult.valueOf(assertionValue.equals(attributeValue));
}
@@ -1779,15 +1772,7 @@
ByteSequence assertionValue)
{
int ret = attributeValue.compareTo(assertionValue);
-
- if (ret < 0)
- {
- return ConditionResult.TRUE;
- }
- else
- {
- return ConditionResult.FALSE;
- }
+ return ConditionResult.valueOf(ret < 0);
}
@@ -1847,15 +1832,7 @@
ByteSequence assertionValue)
{
int ret = attributeValue.compareTo(assertionValue);
-
- if (ret <= 0)
- {
- return ConditionResult.TRUE;
- }
- else
- {
- return ConditionResult.FALSE;
- }
+ return ConditionResult.valueOf(ret <= 0);
}
@@ -1916,15 +1893,7 @@
ByteSequence assertionValue)
{
int ret = attributeValue.compareTo(assertionValue);
-
- if (ret > 0)
- {
- return ConditionResult.TRUE;
- }
- else
- {
- return ConditionResult.FALSE;
- }
+ return ConditionResult.valueOf(ret > 0);
}
@@ -1984,15 +1953,7 @@
ByteSequence assertionValue)
{
int ret = attributeValue.compareTo(assertionValue);
-
- if (ret >= 0)
- {
- return ConditionResult.TRUE;
- }
- else
- {
- return ConditionResult.FALSE;
- }
+ return ConditionResult.valueOf(ret >= 0);
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/TimeBasedMatchingRuleFactory.java b/opendj3-server-dev/src/server/org/opends/server/schema/TimeBasedMatchingRuleFactory.java
index cee1ccf..dd10e8d 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/TimeBasedMatchingRuleFactory.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/TimeBasedMatchingRuleFactory.java
@@ -473,15 +473,7 @@
ByteSequence assertionValue)
{
int ret = compareValues(attributeValue, assertionValue);
-
- if (ret > 0)
- {
- return ConditionResult.TRUE;
- }
- else
- {
- return ConditionResult.FALSE;
- }
+ return ConditionResult.valueOf(ret > 0);
}
@@ -561,15 +553,7 @@
ByteSequence assertionValue)
{
int ret = compareValues(attributeValue, assertionValue);
-
- if (ret < 0)
- {
- return ConditionResult.TRUE;
- }
- else
- {
- return ConditionResult.FALSE;
- }
+ return ConditionResult.valueOf(ret < 0);
}
@@ -1048,37 +1032,16 @@
int assertMonth = bb.getInt(16);
int assertYear = bb.getInt(20);
- if(assertSecond != -1 && assertSecond !=second)
+ if ((assertSecond != -1 && assertSecond != second)
+ || (assertMinute != -1 && assertMinute != minute)
+ || (assertHour != -1 && assertHour != hour)
+ // All the non-zero values should match.
+ || (assertDate != 0 && assertDate != date)
+ || (assertMonth != -1 && assertMonth != month)
+ || (assertYear != 0 && assertYear != year))
{
return ConditionResult.FALSE;
}
-
- if(assertMinute !=-1 && assertMinute !=minute)
- {
- return ConditionResult.FALSE;
- }
-
- if(assertHour !=-1 && assertHour !=hour)
- {
- return ConditionResult.FALSE;
- }
-
- //All the non-zero values should match.
- if(assertDate !=0 && assertDate != date)
- {
- return ConditionResult.FALSE;
- }
-
- if(assertMonth !=-1 && assertMonth != month)
- {
- return ConditionResult.FALSE;
- }
-
- if(assertYear !=0 && assertYear != year)
- {
- return ConditionResult.FALSE;
- }
-
return ConditionResult.TRUE;
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/UserPasswordEqualityMatchingRule.java b/opendj3-server-dev/src/server/org/opends/server/schema/UserPasswordEqualityMatchingRule.java
index f8be52e..0d970cc 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/UserPasswordEqualityMatchingRule.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/UserPasswordEqualityMatchingRule.java
@@ -34,10 +34,10 @@
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.ByteSequence;
import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.ConditionResult;
import org.opends.server.api.EqualityMatchingRule;
import org.opends.server.api.PasswordStorageScheme;
import org.opends.server.core.DirectoryServer;
-import org.forgerock.opendj.ldap.ConditionResult;
import org.opends.server.types.DirectoryException;
import static org.opends.server.schema.SchemaConstants.*;
@@ -182,17 +182,9 @@
return ConditionResult.FALSE;
}
-
// We support the scheme, so make the determination.
- if (storageScheme.passwordMatches(assertionValue,
- ByteString.valueOf(userPWComponents[1])))
- {
- return ConditionResult.TRUE;
- }
- else
- {
- return ConditionResult.FALSE;
- }
+ return ConditionResult.valueOf(storageScheme.passwordMatches(
+ assertionValue, ByteString.valueOf(userPWComponents[1])));
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/types/SearchFilter.java b/opendj3-server-dev/src/server/org/opends/server/types/SearchFilter.java
index f37694b..5df3949 100644
--- a/opendj3-server-dev/src/server/org/opends/server/types/SearchFilter.java
+++ b/opendj3-server-dev/src/server/org/opends/server/types/SearchFilter.java
@@ -3094,28 +3094,15 @@
// See if the entry has an attribute with the requested type.
// If so, then it's a match. If not, then it's not a match.
- if (entry.hasAttribute(attributeType, attributeOptions))
+ ConditionResult result = ConditionResult.valueOf(
+ entry.hasAttribute(attributeType, attributeOptions));
+ if (logger.isTraceEnabled())
{
- if (logger.isTraceEnabled())
- {
- logger.trace(
- "Returning TRUE for presence component %s in " +
- "filter %s for entry %s",
- this, completeFilter, entry.getName());
- }
- return ConditionResult.TRUE;
+ logger.trace(
+ "Returning %s for presence component %s in filter %s for entry %s",
+ result, this, completeFilter, entry.getName());
}
- else
- {
- if (logger.isTraceEnabled())
- {
- logger.trace(
- "Returning FALSE for presence component %s in " +
- "filter %s for entry %s",
- this, completeFilter, entry.getName());
- }
- return ConditionResult.FALSE;
- }
+ return result;
}
diff --git a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/schema/EqualityMatchingRuleTest.java b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/schema/EqualityMatchingRuleTest.java
index 90610dc..aa54007 100644
--- a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/schema/EqualityMatchingRuleTest.java
+++ b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/schema/EqualityMatchingRuleTest.java
@@ -27,10 +27,10 @@
package org.opends.server.schema;
import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.ConditionResult;
import org.opends.server.api.EqualityMatchingRule;
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.AcceptRejectWarn;
-import org.forgerock.opendj.ldap.ConditionResult;
import org.opends.server.types.DirectoryException;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@@ -166,11 +166,7 @@
ConditionResult liveResult =
rule.valuesMatch(normalizedValue1, normalizedValue2);
- if (result == true)
- assertEquals(ConditionResult.TRUE, liveResult);
- else
- assertEquals(ConditionResult.FALSE, liveResult);
-
+ assertEquals(liveResult, ConditionResult.valueOf(result));
}
}
diff --git a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/schema/TimeBasedMatchingRuleTest.java b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/schema/TimeBasedMatchingRuleTest.java
index 81b32a7..b04bd0f 100644
--- a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/schema/TimeBasedMatchingRuleTest.java
+++ b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/schema/TimeBasedMatchingRuleTest.java
@@ -339,8 +339,7 @@
MatchingRule partialTimeRule = DirectoryServer.getMatchingRule(
EXT_PARTIAL_DATE_TIME_NAME.toLowerCase());
ByteString str = partialTimeRule.normalizeAssertionValue(ByteString.valueOf(assertionValue));
- assertTrue(partialTimeRule.valuesMatch(ByteString.valueOf(attributeValue), str) ==
- ConditionResult.TRUE);
+ assertEquals(partialTimeRule.valuesMatch(ByteString.valueOf(attributeValue), str), ConditionResult.TRUE);
}
--
Gitblit v1.10.0