FileChangeNumberIndexDBTest.java revision 6c5c0af35aabc59a56c71e9c9296a7398a3e9176
/*
* 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
*/
@SuppressWarnings("javadoc")
public class FileChangeNumberIndexDBTest extends ReplicationTestCase
{
{
return new Object[][] {
};
}
{
}
@Test
public void testAddAndReadRecords() throws Exception
{
try
{
// Checks
{
}
{
}
{
}
}
finally
{
}
}
@Test
{
try
{
}
finally
{
}
}
/**
* This test verifies purge is working by relying on a very short purge delay.
* The purge can be done only if there is at least one read-only log file, so
* this test ensures the rotation happens, using the rotation based on time.
*/
@Test
{
try
{
// Add records
DN[] baseDNs = { DN.valueOf("o=test1"), DN.valueOf("o=test2"), DN.valueOf("o=test3"), DN.valueOf("o=test4") };
// The CN DB should not be purged at this point
// change the purge delay to a very short time
// add a new record to force the rotation of the log
// Now all changes should have been purged but the last one
int count = 0;
{
count++;
}
}
finally
{
}
}
{
// Prepare data to be stored in the db
// Add records
}
private long addRecord(FileChangeNumberIndexDB cnIndexDB, DN baseDN, CSN csn) throws ChangelogException
{
}
{
final FileChangeNumberIndexDB cnIndexDB =
return cnIndexDB;
}
/**
* The newest record is no longer cleared to ensure persistence to the last
* generated change number across server restarts.
*/
int newestChangeNumber) throws ChangelogException
{
}
{
final ReplServerFakeConfiguration cfg = new ReplServerFakeConfiguration(port, null, 0, 2, 0, 100, null);
cfg.setComputeChangeNumber(true);
return new ReplicationServer(cfg);
}
throws ChangelogException
{
{
}
}
}