CollationMatchingRuleTest.java revision ea1068c292e9b341af6d6b563cd8988a96be20a9
/*
* 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 2008-2009 Sun Microsystems, Inc.
* Portions Copyright 2014-2015 ForgeRock AS
*/
/**
* This Test Class tests various collation matching rules.
*/
@SuppressWarnings("javadoc")
public final class CollationMatchingRuleTest
extends SchemaTestCase
{
/**
* Ensures that the Directory Server is running before executing the
* testcases.
*
* @throws Exception If an unexpected problem occurs.
*/
public void startServer()
throws Exception
{
}
/**
* Test to verify an ADD of an entry containing international characters.
* @throws Exception If an unexpected problem occurs.
*/
@Test
{
"dn: uid=user,o=test",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetorgperson",
"objectClass: top",
"departmentNumber:: w4NiYzExMQ==",
"carLicense:: w6liZTI=",
"uid: user",
"cn:: U8ODbmNoZXo=",
"sn:: UXXDqWJlYw==");
{
"-h", "127.0.0.1",
"-D","cn=directory manager",
"-w","password",
"-a",
"-f", filePath,
};
}
/**
* Test to search the collation equality matching rule using OID.
*/
"CollationMatchingRuleTest.addEntry"})
public void searchCollationEqualityUsingOID() throws Exception
{
//Search the collation rule with OID of en and no suffix in the filter.
newSearchRequest("uid=user,o=test", SearchScope.WHOLE_SUBTREE, "cn:1.3.6.1.4.1.42.2.27.9.4.34.1:=sanchez");
//An entry must be returned.
assertNotNull(e);
}
/**
* Test to search the collation equality matching rule using language Tag.
*/
"CollationMatchingRuleTest.addEntry"})
public void searchCollationEqualityUsingLanguageTag() throws Exception
{
//Search the collation rule with language tag of en and no suffix
//in the filter.
SearchRequest request = newSearchRequest("uid=user,o=test", SearchScope.WHOLE_SUBTREE, "cn:en:=sanchez");
//An entry must be returned.
assertNotNull(e);
}
/**
* Test to search the collation Less than matching rule using OID and suffix.
*/
"CollationMatchingRuleTest.addEntry"})
public void searchCollationLTUsingOIDSuffix() throws Exception
{
//Search the collation rule with OID of es and suffix in the filter.
//An entry must be returned.
assertNotNull(e);
}
/**
* Test to search the collation Less than Equal to matching rule using
* Language Tag and suffix.
*/
"CollationMatchingRuleTest.addEntry"})
public void searchCollationLTEUsingLanguageSuffix() throws Exception
{
//Search the collation rule with tag of fr and suffix in the filter.
SearchRequest request = newSearchRequest("uid=user,o=test", SearchScope.WHOLE_SUBTREE, "carLicense:fr.2:=ebe2");
//An entry must be returned.
assertNotNull(e);
}
/**
* Test to search the collation Greater than matching rule using language
* tag.
*/
"CollationMatchingRuleTest.addEntry"})
public void searchCollationGTUsingLanguage() throws Exception
{
//Search the collation rule with tag of fr in the filter.
SearchRequest request = newSearchRequest("uid=user,o=test", SearchScope.WHOLE_SUBTREE, "carLicense:fr.5:=ebe1");
//An entry must be returned.
assertNotNull(e);
}
/**
* Test to search the collation Greater than Equal to matching rule using
* language tag.
*/
"CollationMatchingRuleTest.addEntry"})
public void searchCollationGTEUsingLanguage() throws Exception
{
//Search the collation rule with tag of es and suffix in the filter.
//An entry must be returned.
assertNotNull(e);
}
/**
* Test to search the collation substring matching rule using
* language tag and suffix.
*/
"CollationMatchingRuleTest.addEntry"})
public void searchCollationSubstring() throws Exception
{
/*Search the collation rule with tag of en and suffix in the filter.
*It searches for string quebec against the value of sn which is
* Qu\u00e9bec.
*/
SearchRequest request = newSearchRequest("uid=user,o=test", SearchScope.WHOLE_SUBTREE, "sn:en.6:=*u*bec");
//An entry must be returned for sn=quebec.
assertNotNull(e);
}
/**
* Test to verify the Sort control works well with the Collation
* Less-than-equal-to matching rule and French Locale.
*/
@Test
public void testSortControlLTERule() throws Exception
{
}
/**
* Test to verify the Sort control works with Collation equality
* matching rule and Spanish locale.
*/
@Test
public void testSortControlEQRule() throws Exception
{
}
/**
* Test to verify the Sort control works with Collation greater
* than matching rule and English locale in a descending order.
*/
@Test
public void testSortControlGTRule() throws Exception
{
}
/**
* Tests the Sort control with the VLV control using a collation equality
* matching rule.
*/
@Test
public void testVLVSortControl() throws Exception
{
}
{
try
{
SearchRequest request = newSearchRequest(DN.valueOf("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, searchFilter)
}
finally
{
}
}
{
{
}
return results;
}
private void populateEntriesForControl() throws Exception
{
"dn: cn=user1,dc=example,dc=com",
"objectclass: inetorgperson",
"cn: user1",
"sn: user1",
"uid: user1",
"displayname:: QXVy4oiawqlsaWVuNA==",
"",
"dn: cn=user2,dc=example,dc=com",
"objectclass: inetorgperson",
"cn: user2",
"sn: user2",
"uid: user2",
"displayname:: QXVy4oiawqlsaWVuMw==",
"",
"dn: cn=user3,dc=example,dc=com",
"objectclass: inetorgperson",
"cn: user3",
"sn: user3",
"uid: user3",
"displayname:: QXVy4oiawqlsaWVuMg==",
"",
"dn: cn=user4,dc=example,dc=com",
"objectclass: inetorgperson",
"cn: user4",
"sn: user4",
"uid: user4",
"displayname:: QXVy4oiawqlsaWVuMQ=="
);
}
}