TestVLVIndex.java revision 7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0
/*
* 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
* 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
* trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2006-2008 Sun Microsystems, Inc.
*/
public class TestVLVIndex extends DirectoryServerTestCase {
private BackendImpl be;
// The DN for "Aaccf Johnson"
// The DN for "Aaron Zimmerman"
// The DN for "Albert Smith"
// The DN for "Albert Zimmerman"
// The DN for "lowercase mcgee"
// The DN for "Mararet Jones"
// The DN for "Mary Jones"
// The DN for "Sam Zweck"
// The DN for "Zorro"
// The DN for suffix
false);
"dn: dc=vlvtest,dc=com",
"objectClass: top",
"objectClass: domain",
"",
"dn: uid=albert.zimmerman,dc=vlvtest,dc=com",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: albert.zimmerman",
"givenName: Albert",
"sn: Zimmerman",
"cn: Albert Zimmerman",
"",
"dn: uid=albert.smith,dc=vlvtest,dc=com",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: albert.smith",
"givenName: Albert",
"sn: Smith",
"cn: Albert Smith",
"",
"dn: uid=aaron.zimmerman,dc=vlvtest,dc=com",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: albert.zimmerman",
"givenName: Aaron",
"givenName: Zeke",
"sn: Zimmerman",
"cn: Aaron Zimmerman",
"",
"dn: uid=mary.jones,dc=vlvtest,dc=com",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: mary.jones",
"givenName: Mary",
"sn: Jones",
"cn: Mary Jones",
"",
"dn: uid=margaret.jones,dc=vlvtest,dc=com",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: margaret.jones",
"givenName: Margaret",
"givenName: Maggie",
"sn: Jones",
"sn: Smith",
"cn: Maggie Jones-Smith",
"",
"dn: uid=aaccf.johnson,dc=vlvtest,dc=com",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: aaccf.johnson",
"givenName: Aaccf",
"sn: Johnson",
"cn: Aaccf Johnson",
"",
"dn: uid=sam.zweck,dc=vlvtest,dc=com",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: sam.zweck",
"givenName: Sam",
"sn: Zweck",
"cn: Sam Zweck",
"",
"dn: uid=lowercase.mcgee,dc=vlvtest,dc=com",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: lowercase.mcgee",
"givenName: lowercase",
"sn: mcgee",
"cn: lowercase mcgee",
"",
"dn: uid=zorro,dc=vlvtest,dc=com",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: zorro",
"sn: Zorro",
"cn: Zorro"
);
}
}
/**
* Populates the JE DB with a set of test data.
*
* @throws Exception If an unexpected problem occurs.
*/
private void populateDB()
throws Exception
{
long id = 1;
{
sortOrder));
id++;
}
}
@Test
{
populateDB();
{
{
}
}
{
}
// Delete the base entry
{
{
}
}
}
{
populateDB();
{
{
int i = 0;
{
{
if(i < 4)
{
}
else
{
}
{
}
}
i++;
}
}
}
}
/**
* Tests performing an internal search using the VLV control to retrieve a
* subset of the entries using an offset of one.
*
* @throws Exception If an unexpected problem occurred.
*/
public void testInternalSearchByOffsetOneOffset()
throws Exception
{
{
}
for (Control c : responseControls)
{
{
if(c instanceof LDAPControl)
{
sortResponse = ServerSideSortResponseControl.DECODER.decode(c.isCritical(), ((LDAPControl)c).getValue());
}
else
{
}
}
{
if(c instanceof LDAPControl)
{
}
else
{
}
}
else
{
}
}
}
/**
* Tests performing an internal search using the VLV control to retrieve a
* subset of the entries using an offset of zero, which should be treated like
* an offset of one.
*
* @throws Exception If an unexpected problem occurred.
*/
public void testInternalSearchByOffsetZeroOffset()
throws Exception
{
{
}
for (Control c : responseControls)
{
{
if(c instanceof LDAPControl)
{
sortResponse = ServerSideSortResponseControl.DECODER.decode(c.isCritical(), ((LDAPControl)c).getValue());
}
else
{
}
}
{
if(c instanceof LDAPControl)
{
}
else
{
}
}
else
{
}
}
}
/**
* Tests performing an internal search using the VLV control to retrieve a
* subset of the entries using an offset that isn't at the beginning of the
* result set but is still completely within the bounds of that set.
*
* @throws Exception If an unexpected problem occurred.
*/
public void testInternalSearchByOffsetThreeOffset()
throws Exception
{
{
}
for (Control c : responseControls)
{
{
if(c instanceof LDAPControl)
{
sortResponse = ServerSideSortResponseControl.DECODER.decode(c.isCritical(), ((LDAPControl)c).getValue());
}
else
{
}
}
{
if(c instanceof LDAPControl)
{
}
else
{
}
}
else
{
}
}
}
/**
* Tests performing an internal search using the VLV control with a negative
* target offset.
*
* @throws Exception If an unexpected problem occurred.
*/
public void testInternalSearchByOffsetNegativeOffset()
throws Exception
{
// It will be successful because it's not a critical control.
for (Control c : responseControls)
{
{
if(c instanceof LDAPControl)
{
}
else
{
}
}
}
}
/**
* Tests performing an internal search using the VLV control with an offset of
* one but a beforeCount that puts the start position at a negative value.
*
* @throws Exception If an unexpected problem occurred.
*/
public void testInternalSearchByOffsetNegativeStartPosition()
throws Exception
{
// It will be successful because it's not a critical control.
for (Control c : responseControls)
{
{
if(c instanceof LDAPControl)
{
}
else
{
}
}
}
}
/**
* Tests performing an internal search using the VLV control with a start
* start position beyond the end of the result set.
*
* @throws Exception If an unexpected problem occurred.
*/
public void testInternalSearchByOffsetStartPositionTooHigh()
throws Exception
{
{
}
for (Control c : responseControls)
{
{
if(c instanceof LDAPControl)
{
}
else
{
}
}
}
}
/**
* Tests performing an internal search using the VLV control with a start
* start position within the bounds of the list but not enough remaining
* entries to meet the afterCount
*
* @throws Exception If an unexpected problem occurred.
*/
public void testInternalSearchByOffsetIncompleteAfterCount()
throws Exception
{
{
}
for (Control c : responseControls)
{
{
if(c instanceof LDAPControl)
{
sortResponse = ServerSideSortResponseControl.DECODER.decode(c.isCritical(), ((LDAPControl)c).getValue());
}
else
{
}
}
{
if(c instanceof LDAPControl)
{
}
else
{
}
}
else
{
}
}
}
/**
* Tests performing an internal search using the VLV control to retrieve a
* subset of the entries using an assertion value before any actual value in
* the list.
*
* @throws Exception If an unexpected problem occurred.
*/
public void testInternalSearchByValueBeforeAll()
throws Exception
{
{
}
for (Control c : responseControls)
{
{
if(c instanceof LDAPControl)
{
sortResponse = ServerSideSortResponseControl.DECODER.decode(c.isCritical(), ((LDAPControl)c).getValue());
}
else
{
}
}
{
if(c instanceof LDAPControl)
{
}
else
{
}
}
else
{
}
}
}
/**
* Tests performing an internal search using the VLV control to retrieve a
* subset of the entries using an assertion value that matches the first value
* in the list.
*
* @throws Exception If an unexpected problem occurred.
*/
public void testInternalSearchByValueMatchesFirst()
throws Exception
{
{
}
for (Control c : responseControls)
{
{
if(c instanceof LDAPControl)
{
sortResponse = ServerSideSortResponseControl.DECODER.decode(c.isCritical(), ((LDAPControl)c).getValue());
}
else
{
}
}
{
if(c instanceof LDAPControl)
{
}
else
{
}
}
else
{
}
}
}
/**
* Tests performing an internal search using the VLV control to retrieve a
* subset of the entries using an assertion value that matches the third value
* in the list.
*
* @throws Exception If an unexpected problem occurred.
*/
public void testInternalSearchByValueMatchesThird()
throws Exception
{
{
}
for (Control c : responseControls)
{
{
if(c instanceof LDAPControl)
{
sortResponse = ServerSideSortResponseControl.DECODER.decode(c.isCritical(), ((LDAPControl)c).getValue());
}
else
{
}
}
{
if(c instanceof LDAPControl)
{
}
else
{
}
}
else
{
}
}
}
/**
* Tests performing an internal search using the VLV control to retrieve a
* subset of the entries using an assertion value that matches the third value
* in the list and includes a nonzero before count.
*
* @throws Exception If an unexpected problem occurred.
*/
public void testInternalSearchByValueMatchesThirdWithBeforeCount()
throws Exception
{
{
}
for (Control c : responseControls)
{
{
if(c instanceof LDAPControl)
{
sortResponse = ServerSideSortResponseControl.DECODER.decode(c.isCritical(), ((LDAPControl)c).getValue());
}
else
{
}
}
{
if(c instanceof LDAPControl)
{
}
else
{
}
}
else
{
}
}
}
/**
* Tests performing an internal search using the VLV control to retrieve a
* subset of the entries using an assertion value that is after all values in
* the list.
*
* @throws Exception If an unexpected problem occurred.
*/
public void testInternalSearchByValueAfterAll()
throws Exception
{
// It will be successful because the control isn't critical.
// Null values for given name are still bigger then zz
{
}
for (Control c : responseControls)
{
{
if(c instanceof LDAPControl)
{
}
else
{
}
}
}
}
}