From 2244adc1436c0409d865d6934b9a73a9dc7f733c Mon Sep 17 00:00:00 2001
From: Nicolas Capponi <nicolas.capponi@forgerock.com>
Date: Fri, 07 Nov 2014 14:38:35 +0000
Subject: [PATCH] OPENDJ-1591 CR-5092 Add missing test cases for matching rules
---
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeOrderingMatchingRuleTest.java | 84 ++++
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/IntegerEqualityMatchingRuleTest.java | 72 +++
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/PresentationAddressEqualityMatchingRuleTest.java | 64 +++
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactIA5EqualityMatchingRuleTest.java | 8
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/DirectoryStringFirstComponentEqualityMatchingRuleTest.java | 61 +++
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/UserPasswordExactEqualityMatchingRuleTest.java | 61 +++
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreOrderingMatchingRuleTest.java | 15
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/IntegerOrderingMatchingRuleTest.java | 72 +++
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/NumericStringSubstringMatchingRuleTest.java | 113 +++++
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/WordEqualityMatchingRuleTest.java | 74 +++
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactEqualityMatchingRuleTest.java | 6
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/UniqueMemberEqualityMatchingRuleTest.java | 67 +++
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/UUIDEqualityMatchingRuleTest.java | 70 +++
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/BooleanEqualityMatchingRuleTest.java | 15
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/NumericStringOrderingMatchingRuleTest.java | 66 +++
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/BitStringEqualityMatchingRuleTest.java | 9
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactOrderingMatchingRuleTest.java | 4
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5EqualityMatchingRuleTest.java | 7
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/UUIDOrderingMatchingRuleTest.java | 66 +++
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreEqualityMatchingRuleTest.java | 4
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeEqualityMatchingRuleTest.java | 93 ++++
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/NumericStringEqualityMatchingRuleTest.java | 66 +++
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/ProtocolInformationEqualityMatchingRuleTest.java | 64 +++
23 files changed, 1,141 insertions(+), 20 deletions(-)
diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/BitStringEqualityMatchingRuleTest.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/BitStringEqualityMatchingRuleTest.java
index 59a3edc..e788f2b 100644
--- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/BitStringEqualityMatchingRuleTest.java
+++ b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/BitStringEqualityMatchingRuleTest.java
@@ -38,7 +38,11 @@
@Override
@DataProvider(name = "matchingRuleInvalidAttributeValues")
public Object[][] createMatchingRuleInvalidAttributeValues() {
- return new Object[][] { { "\'a\'B" }, { "0" }, { "010101" }, { "\'10101" },
+ return new Object[][] {
+ { "\'a\'B" },
+ { "0" },
+ { "010101" },
+ { "\'10101" },
{ "\'1010\'A" }, };
}
@@ -46,7 +50,8 @@
@Override
@DataProvider(name = "matchingrules")
public Object[][] createMatchingRuleTest() {
- return new Object[][] { { "\'0\'B", "\'0\'B", ConditionResult.TRUE },
+ return new Object[][] {
+ { "\'0\'B", "\'0\'B", ConditionResult.TRUE },
{ "\'1\'B", "\'1\'B", ConditionResult.TRUE },
{ "\'0\'B", "\'1\'B", ConditionResult.FALSE }, };
}
diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/BooleanEqualityMatchingRuleTest.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/BooleanEqualityMatchingRuleTest.java
index 6806cb7..b1e7398 100644
--- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/BooleanEqualityMatchingRuleTest.java
+++ b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/BooleanEqualityMatchingRuleTest.java
@@ -46,11 +46,16 @@
@Override
@DataProvider(name = "matchingrules")
public Object[][] createMatchingRuleTest() {
- return new Object[][] { { "TRUE", "true", ConditionResult.TRUE },
- { "YES", "true", ConditionResult.TRUE }, { "ON", "true", ConditionResult.TRUE },
- { "1", "true", ConditionResult.TRUE }, { "FALSE", "false", ConditionResult.TRUE },
- { "NO", "false", ConditionResult.TRUE }, { "OFF", "false", ConditionResult.TRUE },
- { "0", "false", ConditionResult.TRUE }, { "TRUE", "false", ConditionResult.FALSE }, };
+ return new Object[][] {
+ { "TRUE", "true", ConditionResult.TRUE },
+ { "YES", "true", ConditionResult.TRUE },
+ { "ON", "true", ConditionResult.TRUE },
+ { "1", "true", ConditionResult.TRUE },
+ { "FALSE", "false", ConditionResult.TRUE },
+ { "NO", "false", ConditionResult.TRUE },
+ { "OFF", "false", ConditionResult.TRUE },
+ { "0", "false", ConditionResult.TRUE },
+ { "TRUE", "false", ConditionResult.FALSE }, };
}
/** {@inheritDoc} */
diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactEqualityMatchingRuleTest.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactEqualityMatchingRuleTest.java
index 2e5ba4e..d12cc61 100644
--- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactEqualityMatchingRuleTest.java
+++ b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactEqualityMatchingRuleTest.java
@@ -46,12 +46,14 @@
@Override
@DataProvider(name = "matchingrules")
public Object[][] createMatchingRuleTest() {
- return new Object[][] { { "12345678", "12345678", ConditionResult.TRUE },
+ return new Object[][] {
+ { "12345678", "12345678", ConditionResult.TRUE },
{ "12345678\u2163", "12345678\u2163", ConditionResult.TRUE },
{ "ABC45678", "ABC45678", ConditionResult.TRUE },
{ " ABC45678 ", "ABC45678", ConditionResult.TRUE },
{ "ABC 45678", "ABC 45678", ConditionResult.TRUE },
- { " ", " ", ConditionResult.TRUE }, { "", "", ConditionResult.TRUE },
+ { " ", " ", ConditionResult.TRUE },
+ { "", "", ConditionResult.TRUE },
{ "ABC45678", "abc45678", ConditionResult.FALSE }, };
}
diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactIA5EqualityMatchingRuleTest.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactIA5EqualityMatchingRuleTest.java
index 09f2e2b..abf20b3 100644
--- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactIA5EqualityMatchingRuleTest.java
+++ b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactIA5EqualityMatchingRuleTest.java
@@ -39,21 +39,23 @@
@Override
@DataProvider(name = "matchingRuleInvalidAttributeValues")
public Object[][] createMatchingRuleInvalidAttributeValues() {
- return new Object[][] { { "12345678\uFFFD" }, };
+ return new Object[][] {
+ { "12345678\uFFFD" },
+ };
}
/** {@inheritDoc} */
@Override
@DataProvider(name = "matchingrules")
public Object[][] createMatchingRuleTest() {
- return new Object[][] { { "12345678", "12345678", ConditionResult.TRUE },
+ return new Object[][] {
+ { "12345678", "12345678", ConditionResult.TRUE },
{ "ABC45678", "ABC45678", ConditionResult.TRUE },
{ "ABC45678", "abc45678", ConditionResult.FALSE },
{ "\u0020foo\u0020bar\u0020\u0020", "foo bar", ConditionResult.TRUE },
{ "test\u00AD\u200D", "test", ConditionResult.TRUE },
{ "foo\u000Bbar", "foo\u0020bar", ConditionResult.TRUE },
{ "foo\u070Fbar", "foobar", ConditionResult.TRUE },
-
};
}
diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactOrderingMatchingRuleTest.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactOrderingMatchingRuleTest.java
index 93d6b30..b2f0d5a 100644
--- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactOrderingMatchingRuleTest.java
+++ b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactOrderingMatchingRuleTest.java
@@ -45,7 +45,9 @@
@Override
@DataProvider(name = "Orderingmatchingrules")
public Object[][] createOrderingMatchingRuleTestData() {
- return new Object[][] { { "12345678", "02345678", 1 }, { "abcdef", "bcdefa", -1 },
+ return new Object[][] {
+ { "12345678", "02345678", 1 },
+ { "abcdef", "bcdefa", -1 },
{ "abcdef", "abcdef", 0 }, };
}
diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreEqualityMatchingRuleTest.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreEqualityMatchingRuleTest.java
index 7998f33..2c7cab8 100644
--- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreEqualityMatchingRuleTest.java
+++ b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreEqualityMatchingRuleTest.java
@@ -46,6 +46,8 @@
@DataProvider(name = "matchingrules")
public Object[][] createMatchingRuleTest() {
return new Object[][] {
+ { "12345678", "12345678", ConditionResult.TRUE },
+ { "ABC45678", "abc45678", ConditionResult.TRUE },
{ " string ", "string", ConditionResult.TRUE },
{ "string ", "string", ConditionResult.TRUE },
{ " string", "string", ConditionResult.TRUE },
@@ -59,6 +61,8 @@
// Case-folding data below.
{ "foo\u0149bar", "foo\u02BC\u006Ebar", ConditionResult.TRUE },
{ "foo\u017Bbar", "foo\u017Cbar", ConditionResult.TRUE },
+ { "foo\u017BBAR", "foo\u017Cbar", ConditionResult.TRUE },
+
};
}
diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5EqualityMatchingRuleTest.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5EqualityMatchingRuleTest.java
index 2119f78..c826a53 100644
--- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5EqualityMatchingRuleTest.java
+++ b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5EqualityMatchingRuleTest.java
@@ -39,14 +39,17 @@
@Override
@DataProvider(name = "matchingRuleInvalidAttributeValues")
public Object[][] createMatchingRuleInvalidAttributeValues() {
- return new Object[][] { { "12345678\uFFFD" }, };
+ return new Object[][] {
+ { "12345678\uFFFD" },
+ };
}
/** {@inheritDoc} */
@Override
@DataProvider(name = "matchingrules")
public Object[][] createMatchingRuleTest() {
- return new Object[][] { { "12345678", "12345678", ConditionResult.TRUE },
+ return new Object[][] {
+ { "12345678", "12345678", ConditionResult.TRUE },
{ "ABC45678", "ABC45678", ConditionResult.TRUE },
{ "ABC45678", "abc45678", ConditionResult.TRUE }, };
}
diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreOrderingMatchingRuleTest.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreOrderingMatchingRuleTest.java
index 81d3a42..2859857 100644
--- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreOrderingMatchingRuleTest.java
+++ b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreOrderingMatchingRuleTest.java
@@ -45,12 +45,17 @@
@Override
@DataProvider(name = "Orderingmatchingrules")
public Object[][] createOrderingMatchingRuleTestData() {
- return new Object[][] { { "12345678", "02345678", 1 }, { "abcdef", "bcdefa", -1 },
- { "abcdef", "abcdef", 0 }, { "abcdef", "ABCDEF", 0 }, { "abcdef", "aCcdef", -1 },
- { "aCcdef", "abcdef", 1 }, { "foo\u0020bar\u0020\u0020", "foo bar", 0 },
- { "test\u00AD\u200D", "test", 0 }, { "foo\u070Fbar", "foobar", 0 },
+ return new Object[][] {
+ { "12345678", "02345678", 1 }, { "abcdef", "bcdefa", -1 },
+ { "abcdef", "abcdef", 0 }, { "abcdef", "ABCDEF", 0 },
+ { "abcdef", "aCcdef", -1 },
+ { "aCcdef", "abcdef", 1 },
+ { "foo\u0020bar\u0020\u0020", "foo bar", 0 },
+ { "test\u00AD\u200D", "test", 0 },
+ { "foo\u070Fbar", "foobar", 0 },
// Case-folding data below.
- { "foo\u0149bar", "foo\u02BC\u006Ebar", 0 }, { "foo\u017Bbar", "foo\u017Cbar", 0 },
+ { "foo\u0149bar", "foo\u02BC\u006Ebar", 0 },
+ { "foo\u017Bbar", "foo\u017Cbar", 0 },
{ "foo\u017Bbar", "goo\u017Cbar", -1 },
// issue# 3583
{ "a", "\u00f8", -1 }, };
diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/DirectoryStringFirstComponentEqualityMatchingRuleTest.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/DirectoryStringFirstComponentEqualityMatchingRuleTest.java
new file mode 100644
index 0000000..094de8a
--- /dev/null
+++ b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/DirectoryStringFirstComponentEqualityMatchingRuleTest.java
@@ -0,0 +1,61 @@
+/*
+ * 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 legal-notices/CDDLv1_0.txt
+ * or http://forgerock.org/license/CDDLv1.0.html.
+ * 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 legal-notices/CDDLv1_0.txt.
+ * 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 2014 ForgeRock AS
+ */
+package org.forgerock.opendj.ldap.schema;
+
+import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_DIRECTORY_STRING_FIRST_COMPONENT_OID;
+
+import org.testng.annotations.DataProvider;
+
+/**
+ * Test the DirectoryStringFirstComponentEqualityMatchingRule.
+ */
+//TODO: fix matching rule so that commented data in data providers pass
+public class DirectoryStringFirstComponentEqualityMatchingRuleTest extends MatchingRuleTest {
+
+ /** {@inheritDoc} */
+ @Override
+ @DataProvider(name = "matchingRuleInvalidAttributeValues")
+ public Object[][] createMatchingRuleInvalidAttributeValues() {
+ return new Object[][] {};
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ @DataProvider(name = "matchingrules")
+ public Object[][] createMatchingRuleTest() {
+ return new Object[][] {
+ //{"(1.2.8.5 NAME 'testtype' DESC 'full type')", "1.2.8.5", ConditionResult.TRUE },
+ //{"(1.2.8.5 NAME 'testtype' DESC 'full type')", "something", ConditionResult.FALSE },
+ };
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected MatchingRule getRule() {
+ return Schema.getCoreSchema().getMatchingRule(EMR_DIRECTORY_STRING_FIRST_COMPONENT_OID);
+ }
+
+}
diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeEqualityMatchingRuleTest.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeEqualityMatchingRuleTest.java
new file mode 100644
index 0000000..eeeac74
--- /dev/null
+++ b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeEqualityMatchingRuleTest.java
@@ -0,0 +1,93 @@
+/*
+ * 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 legal-notices/CDDLv1_0.txt
+ * or http://forgerock.org/license/CDDLv1.0.html.
+ * 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 legal-notices/CDDLv1_0.txt.
+ * 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 2014 ForgeRock AS
+ */
+package org.forgerock.opendj.ldap.schema;
+
+import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_GENERALIZED_TIME_OID;
+
+import org.forgerock.opendj.ldap.ConditionResult;
+import org.testng.annotations.DataProvider;
+
+/**
+ * Test the GeneralizedTimeEqualityMatchingRule.
+ */
+public class GeneralizedTimeEqualityMatchingRuleTest extends MatchingRuleTest {
+
+ /** {@inheritDoc} */
+ @Override
+ @DataProvider(name = "matchingRuleInvalidAttributeValues")
+ public Object[][] createMatchingRuleInvalidAttributeValues() {
+ return new Object[][] {
+ {"2006september061Z"},
+ {"2006"},
+ {"200609061Z"},
+ {"20060906135Z"},
+ {"200609061350G"},
+ {"2006090613mmZ"},
+ {"20060906135030.011"},
+ {"20060906135030Zx"},
+ {"20060906135030.Z"},
+ {"20060906135030.aZ"},
+ {"20060906135030"},
+ {"20060906135030.123"},
+ {"20060906135030-2500"},
+ {"20060906135030-2070"},
+ // Following values do not pass - they passed in server
+ //{"20060931135030Z"},
+ //{"20060229135030Z"},
+ //{"20060230135030Z"},
+ };
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ @DataProvider(name = "matchingrules")
+ public Object[][] createMatchingRuleTest() {
+ return new Object[][] {
+ {"2006090613Z", "20060906130000.000Z", ConditionResult.TRUE },
+ {"200609061350Z", "20060906135000.000Z", ConditionResult.TRUE },
+ {"200609061351Z", "20060906135000.000Z", ConditionResult.FALSE },
+ {"20060906135030Z", "20060906135030.000Z", ConditionResult.TRUE },
+ {"20060906135030.3Z", "20060906135030.300Z", ConditionResult.TRUE },
+ {"20060906135030.30Z", "20060906135030.300Z", ConditionResult.TRUE },
+ {"20060906135030Z", "20060906135030.000Z", ConditionResult.TRUE },
+ {"20060906135030.0Z", "20060906135030.000Z", ConditionResult.TRUE },
+ {"20060906135030.0118Z", "20060906135030.012Z", ConditionResult.TRUE },
+ {"20060906135030+01", "20060906125030.000Z", ConditionResult.TRUE },
+ {"20060906135030+0101", "20060906124930.000Z", ConditionResult.TRUE },
+ {"20070417055812.318-0500", "20070417105812.318Z", ConditionResult.TRUE },
+ // Following values do not pass - they passed in server
+ //{"2007041705.5Z", "20070417053000.000Z", ConditionResult.TRUE },
+ //{"200704170558.5Z", "20070417055830.000Z", ConditionResult.TRUE },
+ };
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected MatchingRule getRule() {
+ return Schema.getCoreSchema().getMatchingRule(EMR_GENERALIZED_TIME_OID);
+ }
+
+}
diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeOrderingMatchingRuleTest.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeOrderingMatchingRuleTest.java
new file mode 100644
index 0000000..7637195
--- /dev/null
+++ b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeOrderingMatchingRuleTest.java
@@ -0,0 +1,84 @@
+/*
+ * 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 legal-notices/CDDLv1_0.txt
+ * or http://forgerock.org/license/CDDLv1.0.html.
+ * 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 legal-notices/CDDLv1_0.txt.
+ * 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 2009 Sun Microsystems, Inc.
+ */
+package org.forgerock.opendj.ldap.schema;
+
+import static org.forgerock.opendj.ldap.schema.SchemaConstants.OMR_GENERALIZED_TIME_OID;
+
+import org.testng.annotations.DataProvider;
+
+/**
+ * Test the GeneralizedTimeOrderingMatchingRule.
+ */
+public class GeneralizedTimeOrderingMatchingRuleTest extends OrderingMatchingRuleTest {
+
+ /** {@inheritDoc} */
+ @Override
+ @DataProvider(name = "OrderingMatchingRuleInvalidValues")
+ public Object[][] createOrderingMatchingRuleInvalidValues() {
+ return new Object[][] {
+ { "20060912180130"},
+ {"2006123123595aZ"},
+ {"200a1231235959Z"},
+ {"2006j231235959Z"},
+ {"20061231#35959Z"},
+ {"20060912180a30Z"},
+ {"20060912180030Z.01"},
+ {"200609121800"},
+ {"20060912180129.hhZ"},
+ {"20060912180129.1hZ"},
+ {"20060906135030+aa01"},
+ {"2006"},
+ {"20060906135030+3359"},
+ {"20060906135030+2389"},
+ {"20060906135030+2361"},
+ {"20060906135030+"},
+ {"20060906135030+0"},
+ {"20060906135030+010"},
+ };
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ @DataProvider(name = "Orderingmatchingrules")
+ public Object[][] createOrderingMatchingRuleTestData() {
+ return new Object[][] {
+ {"20060906135030+0101", "20060906135030+2359", 1},
+ {"20060912180130Z", "20060912180130Z", 0},
+ {"20060912180130z", "20060912180130Z", 0},
+ {"20060912180130Z", "20060912180129Z", 1},
+ {"20060912180129Z", "20060912180130Z", -1},
+ {"20060912180129.000Z", "20060912180130.001Z", -1},
+ {"20060912180129.1Z", "20060912180130.2Z", -1},
+ {"20060912180129.11Z", "20060912180130.12Z", -1},
+ };
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected MatchingRule getRule() {
+ return Schema.getCoreSchema().getMatchingRule(OMR_GENERALIZED_TIME_OID);
+ }
+}
diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/IntegerEqualityMatchingRuleTest.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/IntegerEqualityMatchingRuleTest.java
new file mode 100644
index 0000000..b0c8961
--- /dev/null
+++ b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/IntegerEqualityMatchingRuleTest.java
@@ -0,0 +1,72 @@
+/*
+ * 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 legal-notices/CDDLv1_0.txt
+ * or http://forgerock.org/license/CDDLv1.0.html.
+ * 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 legal-notices/CDDLv1_0.txt.
+ * 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 2014 ForgeRock AS
+ */
+package org.forgerock.opendj.ldap.schema;
+
+import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_INTEGER_OID;
+
+import org.forgerock.opendj.ldap.ConditionResult;
+import org.testng.annotations.DataProvider;
+
+/**
+ * Test the IntegerEqualityMatchingRule.
+ */
+//TODO: fix matching rule so that commented data in data providers pass
+public class IntegerEqualityMatchingRuleTest extends MatchingRuleTest {
+
+ /** {@inheritDoc} */
+ @Override
+ @DataProvider(name = "matchingRuleInvalidAttributeValues")
+ public Object[][] createMatchingRuleInvalidAttributeValues() {
+ return new Object[][] {
+ //{"01"},
+ //{"00"},
+ //{"-01"},
+ {"1-2"},
+ {"b2"},
+ {"-"},
+ {""},
+ };
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ @DataProvider(name = "matchingrules")
+ public Object[][] createMatchingRuleTest() {
+ return new Object[][] {
+ {"1234567890", "1234567890", ConditionResult.TRUE},
+ {"-1", "-1", ConditionResult.TRUE},
+ //{"-9876543210", "-9876543210", ConditionResult.TRUE},
+ {"1", "-1", ConditionResult.FALSE},
+ };
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected MatchingRule getRule() {
+ return Schema.getCoreSchema().getMatchingRule(EMR_INTEGER_OID);
+ }
+
+}
diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/IntegerOrderingMatchingRuleTest.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/IntegerOrderingMatchingRuleTest.java
new file mode 100644
index 0000000..30e7b8f
--- /dev/null
+++ b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/IntegerOrderingMatchingRuleTest.java
@@ -0,0 +1,72 @@
+/*
+ * 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 legal-notices/CDDLv1_0.txt
+ * or http://forgerock.org/license/CDDLv1.0.html.
+ * 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 legal-notices/CDDLv1_0.txt.
+ * 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 2009 Sun Microsystems, Inc.
+ */
+package org.forgerock.opendj.ldap.schema;
+
+import static org.forgerock.opendj.ldap.schema.SchemaConstants.OMR_INTEGER_OID;
+
+import org.testng.annotations.DataProvider;
+
+/**
+ * Test the IntegerOrderingMatchingRule.
+ */
+//TODO: fix matching rule so that commented data in data providers pass
+public class IntegerOrderingMatchingRuleTest extends OrderingMatchingRuleTest {
+
+ /** {@inheritDoc} */
+ @Override
+ @DataProvider(name = "OrderingMatchingRuleInvalidValues")
+ public Object[][] createOrderingMatchingRuleInvalidValues() {
+ return new Object[][] {
+ {" 63 "},
+ {"- 63"},
+ //{"+63" },
+ {"AB" },
+ {"0xAB"},
+ };
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ @DataProvider(name = "Orderingmatchingrules")
+ public Object[][] createOrderingMatchingRuleTestData() {
+ return new Object[][] {
+ {"1", "0", 1},
+ {"1", "1", 0},
+ {"45", "54", -1},
+ //{"-63", "63", -1},
+ //{"-63", "0", -1},
+ {"63", "0", 1},
+ //{"0", "-63", 1},
+ //{"987654321987654321987654321", "987654321987654321987654322", -1},
+ };
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected MatchingRule getRule() {
+ return Schema.getCoreSchema().getMatchingRule(OMR_INTEGER_OID);
+ }
+}
diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/NumericStringEqualityMatchingRuleTest.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/NumericStringEqualityMatchingRuleTest.java
new file mode 100644
index 0000000..6c8b7c5
--- /dev/null
+++ b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/NumericStringEqualityMatchingRuleTest.java
@@ -0,0 +1,66 @@
+/*
+ * 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 legal-notices/CDDLv1_0.txt
+ * or http://forgerock.org/license/CDDLv1.0.html.
+ * 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 legal-notices/CDDLv1_0.txt.
+ * 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 2014 ForgeRock AS
+ */
+package org.forgerock.opendj.ldap.schema;
+
+import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_NUMERIC_STRING_OID;
+
+import org.forgerock.opendj.ldap.ConditionResult;
+import org.testng.annotations.DataProvider;
+
+/**
+ * Test the NumericStringEqualityMatchingRule.
+ */
+//TODO: fix matching rule so that commented data in data providers pass
+public class NumericStringEqualityMatchingRuleTest extends MatchingRuleTest {
+
+ /** {@inheritDoc} */
+ @Override
+ @DataProvider(name = "matchingRuleInvalidAttributeValues")
+ public Object[][] createMatchingRuleInvalidAttributeValues() {
+ return new Object[][] {
+ //{"A2B1"}
+ };
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ @DataProvider(name = "matchingrules")
+ public Object[][] createMatchingRuleTest() {
+ return new Object[][] {
+ {"1234567890", "1234567890", ConditionResult.TRUE },
+ {" 1234567890 ", "1234567890", ConditionResult.TRUE },
+ //{" 123 4567890 ", "1234567890", ConditionResult.TRUE },
+ {"1234", "5678", ConditionResult.FALSE },
+ };
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected MatchingRule getRule() {
+ return Schema.getCoreSchema().getMatchingRule(EMR_NUMERIC_STRING_OID);
+ }
+
+}
diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/NumericStringOrderingMatchingRuleTest.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/NumericStringOrderingMatchingRuleTest.java
new file mode 100644
index 0000000..096d2cc
--- /dev/null
+++ b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/NumericStringOrderingMatchingRuleTest.java
@@ -0,0 +1,66 @@
+/*
+ * 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 legal-notices/CDDLv1_0.txt
+ * or http://forgerock.org/license/CDDLv1.0.html.
+ * 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 legal-notices/CDDLv1_0.txt.
+ * 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 2009 Sun Microsystems, Inc.
+ */
+package org.forgerock.opendj.ldap.schema;
+
+import static org.forgerock.opendj.ldap.schema.SchemaConstants.OMR_NUMERIC_STRING_OID;
+
+import org.testng.annotations.DataProvider;
+
+/**
+ * Test the NumericStringOrderingMatchingRule.
+ */
+//TODO: fix matching rule so that commented data in data providers pass
+public class NumericStringOrderingMatchingRuleTest extends OrderingMatchingRuleTest {
+
+ /** {@inheritDoc} */
+ @Override
+ @DataProvider(name = "OrderingMatchingRuleInvalidValues")
+ public Object[][] createOrderingMatchingRuleInvalidValues() {
+ return new Object[][] {
+ //{"jfhslur"},
+ //{"123AB"},
+ };
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ @DataProvider(name = "Orderingmatchingrules")
+ public Object[][] createOrderingMatchingRuleTestData() {
+ return new Object[][] {
+ {"1", "999999999999999999999", -1},
+ {"1", "9", -1},
+ {"1", " 1 ", 0},
+ {"0", "1", -1},
+ {"1", "0", 1},
+ };
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected MatchingRule getRule() {
+ return Schema.getCoreSchema().getMatchingRule(OMR_NUMERIC_STRING_OID);
+ }
+}
diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/NumericStringSubstringMatchingRuleTest.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/NumericStringSubstringMatchingRuleTest.java
new file mode 100644
index 0000000..d2a2201
--- /dev/null
+++ b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/NumericStringSubstringMatchingRuleTest.java
@@ -0,0 +1,113 @@
+/*
+ * 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 legal-notices/CDDLv1_0.txt
+ * or http://forgerock.org/license/CDDLv1.0.html.
+ * 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 legal-notices/CDDLv1_0.txt.
+ * 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 2009 Sun Microsystems, Inc.
+ */
+package org.forgerock.opendj.ldap.schema;
+
+import static org.forgerock.opendj.ldap.schema.SchemaConstants.SMR_NUMERIC_STRING_OID;
+
+import org.forgerock.opendj.ldap.ConditionResult;
+import org.testng.annotations.DataProvider;
+
+/**
+ * Test the NumericStringSubstringMatchingRule.
+ */
+@SuppressWarnings("javadoc")
+public class NumericStringSubstringMatchingRuleTest extends SubstringMatchingRuleTest {
+
+ @Override
+ @DataProvider(name = "substringInvalidAssertionValues")
+ public Object[][] createMatchingRuleInvalidAssertionValues() {
+ return new Object[][] {
+ };
+ }
+
+ @Override
+ @DataProvider(name = "substringInvalidAttributeValues")
+ public Object[][] createMatchingRuleInvalidAttributeValues() {
+ return new Object[][] {
+ };
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ @DataProvider(name = "substringFinalMatchData")
+ public Object[][] createSubstringFinalMatchData() {
+ return new Object[][] {
+ {"123456789", "123456789", ConditionResult.TRUE },
+ {"123456789", "456789", ConditionResult.TRUE },
+ {"123456789", "567", ConditionResult.FALSE },
+ {"123456789", "123", ConditionResult.FALSE },
+ {"123456789", " ", ConditionResult.TRUE },
+ {"123456789", "0789", ConditionResult.FALSE },
+ };
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ @DataProvider(name = "substringInitialMatchData")
+ public Object[][] createSubstringInitialMatchData() {
+ return new Object[][] {
+ { "123456789", "12345678", ConditionResult.TRUE },
+ { "123456789", "2345678", ConditionResult.FALSE },
+ { "123456789", "1234", ConditionResult.TRUE },
+ { "123456789", "1", ConditionResult.TRUE },
+ { "123456789", "678", ConditionResult.FALSE },
+ { "123456789", "2", ConditionResult.FALSE },
+ { "123456789", " ", ConditionResult.TRUE },
+ { "123456789", "123456789", ConditionResult.TRUE },
+ { "123456789", "1234567890", ConditionResult.FALSE },
+ };
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ @DataProvider(name = "substringMiddleMatchData")
+ public Object[][] createSubstringMiddleMatchData() {
+ return new Object[][] {
+ // The matching rule requires ordered non overlapping substrings.
+ // Issue #730 was not valid.
+ { "123456789", new String[] {"123", "234", "567", "789"}, ConditionResult.FALSE },
+ { "123456789", new String[] {"123", "234"}, ConditionResult.FALSE },
+ { "123456789", new String[] {"567", "234"}, ConditionResult.FALSE },
+ { "123456789", new String[] {"123", "456"}, ConditionResult.TRUE },
+ { "123456789", new String[] {"123"}, ConditionResult.TRUE },
+ { "123456789", new String[] {"456"}, ConditionResult.TRUE },
+ { "123456789", new String[] {"789"}, ConditionResult.TRUE },
+ { "123456789", new String[] {"123456789"}, ConditionResult.TRUE },
+ { "123456789", new String[] {"1234567890"}, ConditionResult.FALSE },
+ { "123456789", new String[] {"9"}, ConditionResult.TRUE },
+ { "123456789", new String[] {"1"}, ConditionResult.TRUE },
+ { "123456789", new String[] {"0"}, ConditionResult.FALSE },
+ { "123456789", new String[] {" "}, ConditionResult.TRUE },
+ { "123456789", new String[] {"0123"}, ConditionResult.FALSE },
+ };
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected MatchingRule getRule() {
+ return Schema.getCoreSchema().getMatchingRule(SMR_NUMERIC_STRING_OID);
+ }
+}
diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/PresentationAddressEqualityMatchingRuleTest.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/PresentationAddressEqualityMatchingRuleTest.java
new file mode 100644
index 0000000..afad82a
--- /dev/null
+++ b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/PresentationAddressEqualityMatchingRuleTest.java
@@ -0,0 +1,64 @@
+/*
+ * 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 legal-notices/CDDLv1_0.txt
+ * or http://forgerock.org/license/CDDLv1.0.html.
+ * 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 legal-notices/CDDLv1_0.txt.
+ * 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 2014 ForgeRock AS
+ */
+package org.forgerock.opendj.ldap.schema;
+
+import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_PRESENTATION_ADDRESS_OID;
+
+import org.forgerock.opendj.ldap.ConditionResult;
+import org.testng.annotations.DataProvider;
+
+/**
+ * Test the PresentationAddressEqualityMatchingRule.
+ */
+public class PresentationAddressEqualityMatchingRuleTest extends MatchingRuleTest {
+
+ /** {@inheritDoc} */
+ @Override
+ @DataProvider(name = "matchingRuleInvalidAttributeValues")
+ public Object[][] createMatchingRuleInvalidAttributeValues() {
+ return new Object[][] {
+ };
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ @DataProvider(name = "matchingrules")
+ public Object[][] createMatchingRuleTest() {
+ return new Object[][] {
+ {" ", " ", ConditionResult.TRUE },
+ {"string", "string", ConditionResult.TRUE },
+ {"STRING", "string", ConditionResult.TRUE },
+ {"some string", "some other string", ConditionResult.FALSE },
+ };
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected MatchingRule getRule() {
+ return Schema.getCoreSchema().getMatchingRule(EMR_PRESENTATION_ADDRESS_OID);
+ }
+
+}
diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/ProtocolInformationEqualityMatchingRuleTest.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/ProtocolInformationEqualityMatchingRuleTest.java
new file mode 100644
index 0000000..9ef118b
--- /dev/null
+++ b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/ProtocolInformationEqualityMatchingRuleTest.java
@@ -0,0 +1,64 @@
+/*
+ * 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 legal-notices/CDDLv1_0.txt
+ * or http://forgerock.org/license/CDDLv1.0.html.
+ * 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 legal-notices/CDDLv1_0.txt.
+ * 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 2014 ForgeRock AS
+ */
+package org.forgerock.opendj.ldap.schema;
+
+import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_PROTOCOL_INFORMATION_OID;
+
+import org.forgerock.opendj.ldap.ConditionResult;
+import org.testng.annotations.DataProvider;
+
+/**
+ * Test the ProtocolInformationEqualityMatchingRule.
+ */
+public class ProtocolInformationEqualityMatchingRuleTest extends MatchingRuleTest {
+
+ /** {@inheritDoc} */
+ @Override
+ @DataProvider(name = "matchingRuleInvalidAttributeValues")
+ public Object[][] createMatchingRuleInvalidAttributeValues() {
+ return new Object[][] {
+ };
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ @DataProvider(name = "matchingrules")
+ public Object[][] createMatchingRuleTest() {
+ return new Object[][] {
+ {" ", " ", ConditionResult.TRUE },
+ {"string", "string", ConditionResult.TRUE },
+ {"STRING", "string", ConditionResult.TRUE },
+ {"some string", "some other string", ConditionResult.FALSE },
+ };
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected MatchingRule getRule() {
+ return Schema.getCoreSchema().getMatchingRule(EMR_PROTOCOL_INFORMATION_OID);
+ }
+
+}
diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/UUIDEqualityMatchingRuleTest.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/UUIDEqualityMatchingRuleTest.java
new file mode 100644
index 0000000..b54cc0f
--- /dev/null
+++ b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/UUIDEqualityMatchingRuleTest.java
@@ -0,0 +1,70 @@
+/*
+ * 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 legal-notices/CDDLv1_0.txt
+ * or http://forgerock.org/license/CDDLv1.0.html.
+ * 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 legal-notices/CDDLv1_0.txt.
+ * 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 2014 ForgeRock AS
+ */
+package org.forgerock.opendj.ldap.schema;
+
+import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_UUID_OID;
+
+import org.forgerock.opendj.ldap.ConditionResult;
+import org.testng.annotations.DataProvider;
+
+/**
+ * Test the UUIDEqualityMatchingRule.
+ */
+public class UUIDEqualityMatchingRuleTest extends MatchingRuleTest {
+
+ /** {@inheritDoc} */
+ @Override
+ @DataProvider(name = "matchingRuleInvalidAttributeValues")
+ public Object[][] createMatchingRuleInvalidAttributeValues() {
+ return new Object[][] {
+ {"G2345678-9abc-def0-1234-1234567890ab"},
+ {"g2345678-9abc-def0-1234-1234567890ab"},
+ {"12345678/9abc/def0/1234/1234567890ab"},
+ {"12345678-9abc-def0-1234-1234567890a"},
+ };
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ @DataProvider(name = "matchingrules")
+ public Object[][] createMatchingRuleTest() {
+ return new Object[][] {
+ { "12345678-9ABC-DEF0-1234-1234567890ab",
+ "12345678-9abc-def0-1234-1234567890ab", ConditionResult.TRUE },
+ { "12345678-9abc-def0-1234-1234567890ab",
+ "12345678-9abc-def0-1234-1234567890ab", ConditionResult.TRUE },
+ { "02345678-9abc-def0-1234-1234567890ab",
+ "12345678-9abc-def0-1234-1234567890ab", ConditionResult.FALSE },
+ };
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected MatchingRule getRule() {
+ return Schema.getCoreSchema().getMatchingRule(EMR_UUID_OID);
+ }
+
+}
diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/UUIDOrderingMatchingRuleTest.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/UUIDOrderingMatchingRuleTest.java
new file mode 100644
index 0000000..12e7a83
--- /dev/null
+++ b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/UUIDOrderingMatchingRuleTest.java
@@ -0,0 +1,66 @@
+/*
+ * 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 legal-notices/CDDLv1_0.txt
+ * or http://forgerock.org/license/CDDLv1.0.html.
+ * 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 legal-notices/CDDLv1_0.txt.
+ * 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 2009 Sun Microsystems, Inc.
+ */
+package org.forgerock.opendj.ldap.schema;
+
+import static org.forgerock.opendj.ldap.schema.SchemaConstants.OMR_UUID_OID;
+
+import org.testng.annotations.DataProvider;
+
+/**
+ * Test the UUIDOrderingMatchingRule.
+ */
+public class UUIDOrderingMatchingRuleTest extends OrderingMatchingRuleTest {
+
+ /** {@inheritDoc} */
+ @Override
+ @DataProvider(name = "OrderingMatchingRuleInvalidValues")
+ public Object[][] createOrderingMatchingRuleInvalidValues() {
+ return new Object[][] {
+ { "G2345678-9abc-def0-1234-1234567890ab" },
+ { "g2345678-9abc-def0-1234-1234567890ab" },
+ { "12345678/9abc/def0/1234/1234567890ab" },
+ { "12345678-9abc-def0-1234-1234567890a" },
+ };
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ @DataProvider(name = "Orderingmatchingrules")
+ public Object[][] createOrderingMatchingRuleTestData() {
+ return new Object[][] {
+ { "12345678-9ABC-DEF0-1234-1234567890ab", "12345678-9abc-def0-1234-1234567890ab", 0 },
+ { "12345678-9abc-def0-1234-1234567890ab", "12345678-9abc-def0-1234-1234567890ab", 0 },
+ { "02345678-9abc-def0-1234-1234567890ab", "12345678-9abc-def0-1234-1234567890ab", -1 },
+ { "12345678-9abc-def0-1234-1234567890ab", "02345678-9abc-def0-1234-1234567890ab", 1 },
+ };
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected MatchingRule getRule() {
+ return Schema.getCoreSchema().getMatchingRule(OMR_UUID_OID);
+ }
+}
diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/UniqueMemberEqualityMatchingRuleTest.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/UniqueMemberEqualityMatchingRuleTest.java
new file mode 100644
index 0000000..75a85d2
--- /dev/null
+++ b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/UniqueMemberEqualityMatchingRuleTest.java
@@ -0,0 +1,67 @@
+/*
+ * 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 legal-notices/CDDLv1_0.txt
+ * or http://forgerock.org/license/CDDLv1.0.html.
+ * 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 legal-notices/CDDLv1_0.txt.
+ * 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 2014 ForgeRock AS
+ */
+package org.forgerock.opendj.ldap.schema;
+
+import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_UNIQUE_MEMBER_OID;
+
+import org.forgerock.opendj.ldap.ConditionResult;
+import org.testng.annotations.DataProvider;
+
+/**
+ * Test the UniqueMemberEqualityMatchingRule.
+ */
+//TODO: fix matching rule so that commented data in data providers pass
+public class UniqueMemberEqualityMatchingRuleTest extends MatchingRuleTest {
+
+ /** {@inheritDoc} */
+ @Override
+ @DataProvider(name = "matchingRuleInvalidAttributeValues")
+ public Object[][] createMatchingRuleInvalidAttributeValues() {
+ return new Object[][] {
+ //{"1.3.6.1.4.1.1466.0=#04024869,O=Test,C=GB#'123'B"},
+ {"1.3.6.1.4.1.1466.01"}
+ };
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ @DataProvider(name = "matchingrules")
+ public Object[][] createMatchingRuleTest() {
+ return new Object[][] {
+ { "1.3.6.1.4.1.1466.0=#04024869,O=Test,C=GB#'0101'B",
+ "1.3.6.1.4.1.1466.0=#04024869,O=Test,C=GB#'0101'B", ConditionResult.TRUE },
+ { "1.3.6.1.4.1.1466.0=#04024869,O=Test,C=GB#'0101'B",
+ "1.3.6.1.4.1.1466.0=#04024869,o=Test,C=GB#'0101'B", ConditionResult.TRUE },
+ };
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected MatchingRule getRule() {
+ return Schema.getCoreSchema().getMatchingRule(EMR_UNIQUE_MEMBER_OID);
+ }
+
+}
diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/UserPasswordExactEqualityMatchingRuleTest.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/UserPasswordExactEqualityMatchingRuleTest.java
new file mode 100644
index 0000000..ab7ab53
--- /dev/null
+++ b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/UserPasswordExactEqualityMatchingRuleTest.java
@@ -0,0 +1,61 @@
+/*
+ * 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 legal-notices/CDDLv1_0.txt
+ * or http://forgerock.org/license/CDDLv1.0.html.
+ * 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 legal-notices/CDDLv1_0.txt.
+ * 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 2014 ForgeRock AS
+ */
+package org.forgerock.opendj.ldap.schema;
+
+import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_USER_PASSWORD_EXACT_OID;
+
+import org.testng.annotations.DataProvider;
+
+/**
+ * Test the UserPasswordExactEqualityMatchingRule.
+ */
+public class UserPasswordExactEqualityMatchingRuleTest extends MatchingRuleTest {
+
+ /** {@inheritDoc} */
+ @Override
+ @DataProvider(name = "matchingRuleInvalidAttributeValues")
+ public Object[][] createMatchingRuleInvalidAttributeValues() {
+ return new Object[][] {
+
+ };
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ @DataProvider(name = "matchingrules")
+ public Object[][] createMatchingRuleTest() {
+ return new Object[][] {
+
+ };
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected MatchingRule getRule() {
+ return Schema.getCoreSchema().getMatchingRule(EMR_USER_PASSWORD_EXACT_OID);
+ }
+
+}
diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/WordEqualityMatchingRuleTest.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/WordEqualityMatchingRuleTest.java
new file mode 100644
index 0000000..9e67dcd
--- /dev/null
+++ b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/WordEqualityMatchingRuleTest.java
@@ -0,0 +1,74 @@
+/*
+ * 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 legal-notices/CDDLv1_0.txt
+ * or http://forgerock.org/license/CDDLv1.0.html.
+ * 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 legal-notices/CDDLv1_0.txt.
+ * 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 2014 ForgeRock AS
+ */
+package org.forgerock.opendj.ldap.schema;
+
+import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_WORD_OID;
+
+import org.forgerock.opendj.ldap.ConditionResult;
+import org.testng.annotations.DataProvider;
+
+/**
+ * Test the WordEqualityMatchingRule.
+ */
+public class WordEqualityMatchingRuleTest extends MatchingRuleTest {
+
+ /** {@inheritDoc} */
+ @Override
+ @DataProvider(name = "matchingRuleInvalidAttributeValues")
+ public Object[][] createMatchingRuleInvalidAttributeValues() {
+ return new Object[][] {
+ // all values are valid, return an empty table.
+ };
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ @DataProvider(name = "matchingrules")
+ public Object[][] createMatchingRuleTest() {
+ return new Object[][] {
+ {"first word", "first", ConditionResult.TRUE},
+ {"first,word", "first", ConditionResult.TRUE},
+ {"first word", "first", ConditionResult.TRUE},
+ {"first#word", "first", ConditionResult.TRUE},
+ {"first.word", "first", ConditionResult.TRUE},
+ {"first/word", "first", ConditionResult.TRUE},
+ {"first$word", "first", ConditionResult.TRUE},
+ {"first+word", "first", ConditionResult.TRUE},
+ {"first-word", "first", ConditionResult.TRUE},
+ {"first=word", "first", ConditionResult.TRUE},
+ {"word", "first", ConditionResult.FALSE},
+ {"", "empty", ConditionResult.FALSE},
+ {"", "", ConditionResult.TRUE},
+ };
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected MatchingRule getRule() {
+ return Schema.getCoreSchema().getMatchingRule(EMR_WORD_OID);
+ }
+
+}
--
Gitblit v1.10.0