FIFOEntryCacheTestCase.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 Sun Microsystems, Inc.
* Portions Copyright 2013-2015 ForgeRock AS.
*/
/**
* A set of test cases for FIFO entry cache implementation.
*/
public class FIFOEntryCacheTestCase
{
/**
* Initialize the entry cache test.
*
* @throws Exception If an unexpected problem occurs.
*/
public void entryCacheTestInit()
throws Exception
{
// Ensure that the server is running.
// Configure this entry cache.
"dn: cn=FIFO,cn=Entry Caches,cn=config",
"objectClass: ds-cfg-fifo-entry-cache",
"objectClass: ds-cfg-entry-cache",
"objectClass: top",
"cn: FIFO",
"ds-cfg-cache-level: 1",
"ds-cfg-java-class: org.opends.server.extensions.FIFOEntryCache",
"ds-cfg-enabled: true",
// Force GC to make sure we have enough memory for
// the cache capping constraints to work properly.
// Initialize the cache.
super.cache = new FIFOEntryCache();
// Make some dummy test entries.
for(int i = 0; i < super.NUMTESTENTRIES; i++ ) {
"objectClass: person",
"objectClass: inetorgperson",
"objectClass: top",
"objectClass: organizationalperson",
+ "@testdomain.net",
);
}
}
/**
* Finalize the entry cache test.
*
* @throws Exception If an unexpected problem occurs.
*/
public void entryCacheTestFini()
throws Exception
{
super.cache.finalizeEntryCache();
}
/**
* {@inheritDoc}
*/
@Test
public void testContainsEntry()
throws Exception
{
super.testContainsEntry();
}
/**
* {@inheritDoc}
*/
@Test
public void testGetEntry1()
throws Exception
{
super.testGetEntry1();
}
/**
* {@inheritDoc}
*/
@Test
public void testGetEntry2()
throws Exception
{
super.testGetEntry2();
}
/**
* {@inheritDoc}
*/
@Test
public void testGetEntry3()
throws Exception
{
super.testGetEntry3();
}
/**
* {@inheritDoc}
*/
@Test
public void testGetEntryID()
throws Exception
{
super.testGetEntryID();
}
/**
* {@inheritDoc}
*/
@Test
public void testPutEntry()
throws Exception
{
super.testPutEntry();
}
/**
* {@inheritDoc}
*/
@Test
public void testPutEntryIfAbsent()
throws Exception
{
super.testPutEntryIfAbsent();
}
/**
* {@inheritDoc}
*/
@Test
public void testRemoveEntry()
throws Exception
{
super.testRemoveEntry();
}
/**
* {@inheritDoc}
*/
@Test
public void testClear()
throws Exception
{
super.testClear();
}
/**
* {@inheritDoc}
*/
@Test
public void testClearBackend()
throws Exception
{
super.testClearBackend();
}
/**
* {@inheritDoc}
*/
@Test
public void testClearSubtree()
throws Exception
{
super.testClearSubtree();
}
/**
* {@inheritDoc}
*/
@Test
public void testHandleLowMemory()
throws Exception
{
cache.toVerboseString());
for(int i = 0; i < super.NUMTESTENTRIES; i++ ) {
}
super.cache.handleLowMemory();
// Make sure that the entries put previously on the
// cache are no longer there after handleLowMemory.
for(int i = 0; i < super.NUMTESTENTRIES; i++ ) {
cache.toVerboseString());
}
// Clear the cache so that other tests can start from scratch.
}
public void cacheConcurrencySetup()
throws Exception
{
cache.toVerboseString());
}
public void cacheConcurrencyCleanup()
throws Exception
{
// Clear the cache so that other tests can start from scratch.
}
/**
* {@inheritDoc}
*/
threadPoolSize = 10,
invocationCount = 10,
timeOut = 60000)
public void testCacheConcurrency()
throws Exception
{
super.testCacheConcurrency();
}
/**
* Tests cache rotation on specific number of entries.
*/
@Test
public void testCacheRotation()
throws Exception
{
cache.toVerboseString());
for(int i = 0; i < super.NUMTESTENTRIES; i++ ) {
}
// Make sure first NUMTESTENTRIES - MAXENTRIES got rotated.
cache.toVerboseString());
}
// Make sure remaining NUMTESTENTRIES are still in the cache.
for(int i = (super.NUMTESTENTRIES - super.MAXENTRIES);
i < super.NUMTESTENTRIES;
i++)
{
cache.toVerboseString());
}
// Clear the cache so that other tests can start from scratch.
}
}