AbstractSubstringMatchingRuleImplTest.java revision 8ac57ee1cd50fcc3d02b36bea4ab1335924f1d7a
/*
* 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
* 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-2015 ForgeRock AS
*/
/**
* Tests all generic code of AbstractSubstringMatchingRuleImpl.
*/
@SuppressWarnings("javadoc")
public class AbstractSubstringMatchingRuleImplTest extends AbstractSchemaTestCase {
private static class FakeSubstringMatchingRuleImpl extends AbstractSubstringMatchingRuleImpl {
super(SMR_CASE_EXACT_OID, EMR_CASE_EXACT_OID);
}
/** {@inheritDoc} */
public ByteString normalizeAttributeValue(Schema schema, ByteSequence value) throws DecodeException {
return value.toByteString();
}
}
private final IndexingOptions options;
private final boolean normalizedValuesAreReadable;
this(options, true);
}
}
}
public String createMatchAllQuery() {
return "matchAll()";
}
boolean lowerIncluded, boolean upperIncluded) {
if (normalizedValuesAreReadable) {
}
if (lowerIncluded) {
}
if (upperIncluded) {
}
if (normalizedValuesAreReadable) {
}
}
}
}
public IndexingOptions getIndexingOptions() {
return options;
}
}
private MatchingRuleImpl getRule() {
return new FakeSubstringMatchingRuleImpl();
}
static IndexingOptions newIndexingOptions() {
return options;
}
public Object[][] invalidAssertions() {
return new Object[][] {
{ "" },
{ "abc" },
{ "**" },
{ "\\g" },
{ "\\0" },
{ "\\00" },
{ "\\0g" },
{ gen() },
};
}
}
public Object[][] validAssertions() {
return new Object[][] {
// initial substring longer than value
// final substring longer than value
};
}
final char[] array = new char[] {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
for (char c : array) {
}
}
throws Exception {
}
@Test
@SuppressWarnings("unchecked")
public void testSubstringCreateIndexQueryForFinalWithMultipleSubqueries() throws Exception {
"intersect["
+ "]");
}
@Test
public void testSubstringCreateIndexQueryForAllNoSubqueries() throws Exception {
"intersect["
+ "]");
}
@Test
@SuppressWarnings("unchecked")
public void testSubstringCreateIndexQueryWithInitial() throws Exception {
"intersect["
+ "]");
}
@Test
@SuppressWarnings("unchecked")
public void testSubstringCreateIndexQueryWithInitialOverflowsInRange() throws Exception {
// 0x00 is the nul byte, a.k.a. string terminator
// so everything after it is not part of the string
"intersect["
+ "]");
}
@Test
public void testIndexer() throws Exception {
Assertions.assertThat(indexer.getIndexID()).isEqualTo(SMR_CASE_EXACT_OID + ":" + options.substringKeySize());
}
}
return results;
}
}