| | |
| | | @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" }, }; |
| | | } |
| | | |
| | |
| | | @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 }, }; |
| | | } |
| | |
| | | @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} */ |
| | |
| | | @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 }, }; |
| | | } |
| | | |
| | |
| | | @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 }, |
| | | |
| | | }; |
| | | } |
| | | |
| | |
| | | @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 }, }; |
| | | } |
| | | |
| | |
| | | @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 }, |
| | |
| | | // Case-folding data below. |
| | | { "foo\u0149bar", "foo\u02BC\u006Ebar", ConditionResult.TRUE }, |
| | | { "foo\u017Bbar", "foo\u017Cbar", ConditionResult.TRUE }, |
| | | { "foo\u017BBAR", "foo\u017Cbar", ConditionResult.TRUE }, |
| | | |
| | | |
| | | }; |
| | | } |
| | |
| | | @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 }, }; |
| | | } |
| | |
| | | @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 }, }; |
| New file |
| | |
| | | /* |
| | | * 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); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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); |
| | | } |
| | | |
| | | } |