327N/A/*
327N/A * CDDL HEADER START
327N/A *
327N/A * The contents of this file are subject to the terms of the
327N/A * Common Development and Distribution License, Version 1.0 only
327N/A * (the "License"). You may not use this file except in compliance
327N/A * with the License.
327N/A *
6982N/A * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
6982N/A * or http://forgerock.org/license/CDDLv1.0.html.
327N/A * See the License for the specific language governing permissions
327N/A * and limitations under the License.
327N/A *
327N/A * When distributing Covered Code, include this CDDL HEADER in each
6982N/A * file and include the License file at legal-notices/CDDLv1_0.txt.
6982N/A * If applicable, add the following below this CDDL HEADER, with the
6982N/A * fields enclosed by brackets "[]" replaced with your own identifying
6982N/A * information:
327N/A * Portions Copyright [yyyy] [name of copyright owner]
327N/A *
327N/A * CDDL HEADER END
327N/A *
327N/A *
3232N/A * Copyright 2006-2008 Sun Microsystems, Inc.
327N/A */
327N/Apackage org.opends.server.schema;
327N/A
327N/Aimport org.opends.server.api.SubstringMatchingRule;
327N/Aimport org.testng.annotations.DataProvider;
327N/A
327N/A/**
327N/A * Test the NumericStringSubstringMatchingRule.
327N/A */
327N/Apublic class NumericStringSubstringMatchingRuleTest extends
327N/A SubstringMatchingRuleTest
327N/A{
327N/A
327N/A /**
327N/A * {@inheritDoc}
327N/A */
327N/A @Override
327N/A @DataProvider(name="substringMiddleMatchData")
327N/A public Object[][] createSubstringMiddleMatchData()
327N/A {
327N/A return new Object[][] {
942N/A // The matching rule requires ordered non overlapping substrings.
942N/A // Issue #730 was not valid.
942N/A {"123456789", new String[] {"123", "234", "567", "789"}, false },
942N/A {"123456789", new String[] {"123", "234"}, false },
942N/A {"123456789", new String[] {"567", "234"}, false },
327N/A {"123456789", new String[] {"123", "456"}, true },
327N/A {"123456789", new String[] {"123"}, true },
327N/A {"123456789", new String[] {"456"}, true },
327N/A {"123456789", new String[] {"789"}, true },
327N/A {"123456789", new String[] {"123456789"}, true },
327N/A {"123456789", new String[] {"1234567890"}, false },
327N/A {"123456789", new String[] {"9"}, true },
327N/A {"123456789", new String[] {"1"}, true },
327N/A {"123456789", new String[] {"0"}, false },
680N/A {"123456789", new String[] {" "}, true },
327N/A {"123456789", new String[] {"0123"}, false },
327N/A };
327N/A }
327N/A
327N/A /**
327N/A * {@inheritDoc}
327N/A */
327N/A @Override
2342N/A protected SubstringMatchingRule getRule()
327N/A {
327N/A return new NumericStringSubstringMatchingRule();
327N/A }
327N/A
327N/A /**
327N/A * {@inheritDoc}
327N/A */
327N/A @Override
327N/A @DataProvider(name="substringInitialMatchData")
327N/A public Object[][] createSubstringInitialMatchData()
327N/A {
327N/A return new Object[][] {
327N/A {"123456789", "12345678", true },
327N/A {"123456789", "2345678", false },
327N/A {"123456789", "1234", true },
327N/A {"123456789", "1", true },
327N/A {"123456789", "678", false },
327N/A {"123456789", "2", false },
327N/A {"123456789", " ", true },
327N/A {"123456789", "123456789", true },
327N/A {"123456789", "1234567890", false },
327N/A };
327N/A }
327N/A
327N/A /**
327N/A * {@inheritDoc}
327N/A */
327N/A @Override
327N/A @DataProvider(name="substringFinalMatchData")
327N/A public Object[][] createSubstringFinalMatchData()
327N/A {
327N/A return new Object[][] {
327N/A {"123456789", "123456789", true },
327N/A {"123456789", "456789", true },
327N/A {"123456789", "567", false },
327N/A {"123456789", "123", false },
327N/A {"123456789", " ", true },
327N/A {"123456789", "0789", false },
327N/A };
327N/A }
327N/A}