From dec33c05b7e8c1ecfdcdc44fb3a829d72a4073c3 Mon Sep 17 00:00:00 2001
From: abobrov <abobrov@localhost>
Date: Mon, 20 Aug 2007 13:55:22 +0000
Subject: [PATCH] - add common toVerboseString method that reflects private toVerboseString method, if any, in related entry cache implementation. - use ServerConstants.EOL where appropriate. - enable entry cache unit tests again [IllegalMonitorStateException should be resolved in r2688/FileSystemEntryCache.java].
---
opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/SoftReferenceEntryCacheTestCase.java | 28 ++--
opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/FIFOEntryCacheTestCase.java | 50 ++++---
opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/FileSystemEntryCacheTestCase.java | 76 +++++++-----
opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/CommonEntryCacheTestCase.java | 162 +++++++++++++++++----------
4 files changed, 185 insertions(+), 131 deletions(-)
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/CommonEntryCacheTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/CommonEntryCacheTestCase.java
index a390f9d..b85b549 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/CommonEntryCacheTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/CommonEntryCacheTestCase.java
@@ -28,6 +28,7 @@
+import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.locks.Lock;
@@ -40,6 +41,7 @@
import org.opends.server.types.Entry;
import org.opends.server.types.LockType;
import org.opends.server.admin.std.server.EntryCacheCfg;
+import org.opends.server.util.ServerConstants;
import static org.testng.Assert.*;
@@ -106,6 +108,29 @@
/**
+ * Reflection of the toVerboseString implementation method.
+ */
+ protected String toVerboseString()
+ throws Exception
+ {
+ final Method[] cacheMethods =
+ cache.getClass().getDeclaredMethods();
+
+ for (int i = 0; i < cacheMethods.length; ++i) {
+ if (cacheMethods[i].getName().equals("toVerboseString")) {
+ cacheMethods[i].setAccessible(true);
+ Object verboseString =
+ cacheMethods[i].invoke(cache, (Object[]) null);
+ return (String) verboseString;
+ }
+ }
+
+ return null;
+ }
+
+
+
+ /**
* Tests the <CODE>containsEntry</CODE> method.
*
* @throws Exception If an unexpected problem occurs.
@@ -113,22 +138,24 @@
public void testContainsEntry()
throws Exception
{
- assertNull(cache.toVerboseString(),
- "Expected empty cache. " + "Cache contents:\n" +
- cache.toVerboseString());
+ assertNull(toVerboseString(),
+ "Expected empty cache. " + "Cache contents:" + ServerConstants.EOL +
+ toVerboseString());
TestCaseUtils.initializeTestBackend(false);
Backend b = DirectoryServer.getBackend(DN.decode("o=test"));
assertFalse(cache.containsEntry(testEntriesList.get(0).getDN()),
"Not expected to find " + testEntriesList.get(0).getDN().toString() +
- " in the cache. Cache contents:\n" + cache.toVerboseString());
+ " in the cache. Cache contents:" + ServerConstants.EOL +
+ toVerboseString());
cache.putEntry(testEntriesList.get(0), b, 1);
assertTrue(cache.containsEntry(testEntriesList.get(0).getDN()),
"Expected to find " + testEntriesList.get(0).getDN().toString() +
- " in the cache. Cache contents:\n" + cache.toVerboseString());
+ " in the cache. Cache contents:" + ServerConstants.EOL +
+ toVerboseString());
// Clear the cache so that other tests can start from scratch.
cache.clear();
@@ -145,22 +172,24 @@
public void testGetEntry1()
throws Exception
{
- assertNull(cache.toVerboseString(),
- "Expected empty cache. " + "Cache contents:\n" +
- cache.toVerboseString());
+ assertNull(toVerboseString(),
+ "Expected empty cache. " + "Cache contents:" + ServerConstants.EOL +
+ toVerboseString());
TestCaseUtils.initializeTestBackend(false);
Backend b = DirectoryServer.getBackend(DN.decode("o=test"));
assertNull(cache.getEntry(testEntriesList.get(0).getDN()),
"Not expected to find " + testEntriesList.get(0).getDN().toString() +
- " in the cache. Cache contents:\n" + cache.toVerboseString());
+ " in the cache. Cache contents:" + ServerConstants.EOL +
+ toVerboseString());
cache.putEntry(testEntriesList.get(0), b, 1);
assertNotNull(cache.getEntry(testEntriesList.get(0).getDN()),
"Expected to find " + testEntriesList.get(0).getDN().toString() +
- " in the cache. Cache contents:\n" + cache.toVerboseString());
+ " in the cache. Cache contents:" + ServerConstants.EOL +
+ toVerboseString());
// Clear the cache so that other tests can start from scratch.
cache.clear();
@@ -178,9 +207,9 @@
public void testGetEntry2()
throws Exception
{
- assertNull(cache.toVerboseString(),
- "Expected empty cache. " + "Cache contents:\n" +
- cache.toVerboseString());
+ assertNull(toVerboseString(),
+ "Expected empty cache. " + "Cache contents:" + ServerConstants.EOL +
+ toVerboseString());
TestCaseUtils.initializeTestBackend(false);
Backend b = DirectoryServer.getBackend(DN.decode("o=test"));
@@ -188,14 +217,16 @@
assertNull(cache.getEntry(testEntriesList.get(0).getDN(), LockType.NONE,
new ArrayList<Lock>()),
"Not expected to find " + testEntriesList.get(0).getDN().toString() +
- " in the cache. Cache contents:\n" + cache.toVerboseString());
+ " in the cache. Cache contents:" + ServerConstants.EOL +
+ toVerboseString());
cache.putEntry(testEntriesList.get(0), b, 1);
assertNotNull(cache.getEntry(testEntriesList.get(0).getDN(), LockType.NONE,
new ArrayList<Lock>()),
"Expected to find " + testEntriesList.get(0).getDN().toString() +
- " in the cache. Cache contents:\n" + cache.toVerboseString());
+ " in the cache. Cache contents:" + ServerConstants.EOL +
+ toVerboseString());
// Clear the cache so that other tests can start from scratch.
cache.clear();
@@ -213,22 +244,24 @@
public void testGetEntry3()
throws Exception
{
- assertNull(cache.toVerboseString(),
- "Expected empty cache. " + "Cache contents:\n" +
- cache.toVerboseString());
+ assertNull(toVerboseString(),
+ "Expected empty cache. " + "Cache contents:" + ServerConstants.EOL +
+ toVerboseString());
TestCaseUtils.initializeTestBackend(false);
Backend b = DirectoryServer.getBackend(DN.decode("o=test"));
assertNull(cache.getEntry(b, -1, LockType.NONE, new ArrayList<Lock>()),
"Not expected to find entry id " + Integer.toString(-1) +
- " in the cache. Cache contents:\n" + cache.toVerboseString());
+ " in the cache. Cache contents:" + ServerConstants.EOL +
+ toVerboseString());
cache.putEntry(testEntriesList.get(0), b, 1);
assertNotNull(cache.getEntry(b, 1, LockType.NONE, new ArrayList<Lock>()),
"Expected to find entry id " + Integer.toString(1) +
- " in the cache. Cache contents:\n" + cache.toVerboseString());
+ " in the cache. Cache contents:" + ServerConstants.EOL +
+ toVerboseString());
// Clear the cache so that other tests can start from scratch.
cache.clear();
@@ -244,22 +277,24 @@
public void testGetEntryID()
throws Exception
{
- assertNull(cache.toVerboseString(),
- "Expected empty cache. " + "Cache contents:\n" +
- cache.toVerboseString());
+ assertNull(toVerboseString(),
+ "Expected empty cache. " + "Cache contents:" + ServerConstants.EOL +
+ toVerboseString());
TestCaseUtils.initializeTestBackend(false);
Backend b = DirectoryServer.getBackend(DN.decode("o=test"));
assertEquals(cache.getEntryID(testEntriesList.get(0).getDN()), -1,
"Not expected to find " + testEntriesList.get(0).getDN().toString() +
- " in the cache. Cache contents:\n" + cache.toVerboseString());
+ " in the cache. Cache contents:" + ServerConstants.EOL +
+ toVerboseString());
cache.putEntry(testEntriesList.get(0), b, 1);
assertEquals(cache.getEntryID(testEntriesList.get(0).getDN()), 1,
"Expected to find " + testEntriesList.get(0).getDN().toString() +
- " in the cache. Cache contents:\n" + cache.toVerboseString());
+ " in the cache. Cache contents:" + ServerConstants.EOL +
+ toVerboseString());
// Clear the cache so that other tests can start from scratch.
cache.clear();
@@ -275,9 +310,9 @@
public void testPutEntry()
throws Exception
{
- assertNull(cache.toVerboseString(),
- "Expected empty cache. " + "Cache contents:\n" +
- cache.toVerboseString());
+ assertNull(toVerboseString(),
+ "Expected empty cache. " + "Cache contents:" + ServerConstants.EOL +
+ toVerboseString());
TestCaseUtils.initializeTestBackend(false);
Backend b = DirectoryServer.getBackend(DN.decode("o=test"));
@@ -286,7 +321,8 @@
assertNotNull(cache.getEntry(testEntriesList.get(0).getDN()),
"Expected to find " + testEntriesList.get(0).getDN().toString() +
- " in the cache. Cache contents:\n" + cache.toVerboseString());
+ " in the cache. Cache contents:" + ServerConstants.EOL +
+ toVerboseString());
// Clear the cache so that other tests can start from scratch.
cache.clear();
@@ -302,20 +338,22 @@
public void testPutEntryIfAbsent()
throws Exception
{
- assertNull(cache.toVerboseString(),
- "Expected empty cache. " + "Cache contents:\n" +
- cache.toVerboseString());
+ assertNull(toVerboseString(),
+ "Expected empty cache. " + "Cache contents:" + ServerConstants.EOL +
+ toVerboseString());
TestCaseUtils.initializeTestBackend(false);
Backend b = DirectoryServer.getBackend(DN.decode("o=test"));
assertTrue(cache.putEntryIfAbsent(testEntriesList.get(0), b, 1),
"Not expected to find " + testEntriesList.get(0).getDN().toString() +
- " in the cache. Cache contents:\n" + cache.toVerboseString());
+ " in the cache. Cache contents:" + ServerConstants.EOL +
+ toVerboseString());
assertFalse(cache.putEntryIfAbsent(testEntriesList.get(0), b, 1),
"Expected to find " + testEntriesList.get(0).getDN().toString() +
- " in the cache. Cache contents:\n" + cache.toVerboseString());
+ " in the cache. Cache contents:" + ServerConstants.EOL +
+ toVerboseString());
// Clear the cache so that other tests can start from scratch.
cache.clear();
@@ -331,9 +369,9 @@
public void testRemoveEntry()
throws Exception
{
- assertNull(cache.toVerboseString(),
- "Expected empty cache. " + "Cache contents:\n" +
- cache.toVerboseString());
+ assertNull(toVerboseString(),
+ "Expected empty cache. " + "Cache contents:" + ServerConstants.EOL +
+ toVerboseString());
TestCaseUtils.initializeTestBackend(false);
Backend b = DirectoryServer.getBackend(DN.decode("o=test"));
@@ -344,7 +382,8 @@
assertNull(cache.getEntry(testEntriesList.get(0).getDN()),
"Not expected to find " + testEntriesList.get(0).getDN().toString() +
- " in the cache. Cache contents:\n" + cache.toVerboseString());
+ " in the cache. Cache contents:" + ServerConstants.EOL +
+ toVerboseString());
// Clear the cache so that other tests can start from scratch.
cache.clear();
@@ -360,9 +399,9 @@
public void testClear()
throws Exception
{
- assertNull(cache.toVerboseString(),
- "Expected empty cache. " + "Cache contents:\n" +
- cache.toVerboseString());
+ assertNull(toVerboseString(),
+ "Expected empty cache. " + "Cache contents:" + ServerConstants.EOL +
+ toVerboseString());
TestCaseUtils.initializeTestBackend(false);
Backend b = DirectoryServer.getBackend(DN.decode("o=test"));
@@ -373,7 +412,8 @@
assertNull(cache.getEntry(testEntriesList.get(0).getDN()),
"Not expected to find " + testEntriesList.get(0).getDN().toString() +
- " in the cache. Cache contents:\n" + cache.toVerboseString());
+ " in the cache. Cache contents:" + ServerConstants.EOL +
+ toVerboseString());
// Clear the cache so that other tests can start from scratch.
cache.clear();
@@ -390,9 +430,9 @@
public void testClearBackend()
throws Exception
{
- assertNull(cache.toVerboseString(),
- "Expected empty cache. " + "Cache contents:\n" +
- cache.toVerboseString());
+ assertNull(toVerboseString(),
+ "Expected empty cache. " + "Cache contents:" + ServerConstants.EOL +
+ toVerboseString());
TestCaseUtils.initializeTestBackend(false);
Backend b = DirectoryServer.getBackend(DN.decode("o=test"));
@@ -405,13 +445,13 @@
assertNull(cache.getEntry(b, 1, LockType.NONE, new ArrayList<Lock>()),
"Not expected to find entry id " + Integer.toString(1) + " on backend " +
- b.getBackendID() + " in the cache. Cache contents:\n" +
- cache.toVerboseString());
+ b.getBackendID() + " in the cache. Cache contents:" +
+ ServerConstants.EOL + toVerboseString());
assertNotNull(cache.getEntry(c, 1, LockType.NONE, new ArrayList<Lock>()),
"Expected to find entry id " + Integer.toString(1) + " on backend " +
- c.getBackendID() + " in the cache. Cache contents:\n" +
- cache.toVerboseString());
+ c.getBackendID() + " in the cache. Cache contents:" +
+ ServerConstants.EOL + toVerboseString());
// Clear the cache so that other tests can start from scratch.
cache.clear();
@@ -427,9 +467,9 @@
public void testClearSubtree()
throws Exception
{
- assertNull(cache.toVerboseString(),
- "Expected empty cache. " + "Cache contents:\n" +
- cache.toVerboseString());
+ assertNull(toVerboseString(),
+ "Expected empty cache. " + "Cache contents:" + ServerConstants.EOL +
+ toVerboseString());
TestCaseUtils.initializeTestBackend(false);
Backend b = DirectoryServer.getBackend(DN.decode("o=test"));
@@ -444,11 +484,13 @@
assertNull(cache.getEntry(testEntriesList.get(0).getDN()),
"Not expected to find " + testEntriesList.get(0).getDN().toString() +
- " in the cache. Cache contents:\n" + cache.toVerboseString());
+ " in the cache. Cache contents:" + ServerConstants.EOL +
+ toVerboseString());
assertNotNull(cache.getEntry(testEntry.getDN()),
"Expected to find " + testEntry.getDN().toString() +
- " in the cache. Cache contents:\n" + cache.toVerboseString());
+ " in the cache. Cache contents:" + ServerConstants.EOL +
+ toVerboseString());
// Clear the cache so that other tests can start from scratch.
cache.clear();
@@ -464,9 +506,9 @@
public void testHandleLowMemory()
throws Exception
{
- assertNull(cache.toVerboseString(),
- "Expected empty cache. " + "Cache contents:\n" +
- cache.toVerboseString());
+ assertNull(toVerboseString(),
+ "Expected empty cache. " + "Cache contents:" + ServerConstants.EOL +
+ toVerboseString());
cache.handleLowMemory();
@@ -486,9 +528,9 @@
throws Exception
{
if(cacheEmptyAssert.compareAndSet(false, true)) {
- assertNull(cache.toVerboseString(),
- "Expected empty cache. " + "Cache contents:\n" +
- cache.toVerboseString());
+ assertNull(toVerboseString(),
+ "Expected empty cache. " + "Cache contents:" + ServerConstants.EOL +
+ toVerboseString());
}
Backend b = DirectoryServer.getBackend(DN.decode("o=test"));
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/FIFOEntryCacheTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/FIFOEntryCacheTestCase.java
index 4b2acf3..a981896 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/FIFOEntryCacheTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/FIFOEntryCacheTestCase.java
@@ -37,6 +37,7 @@
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.DN;
import org.opends.server.types.Entry;
+import org.opends.server.util.ServerConstants;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;
import static org.testng.Assert.*;
@@ -137,7 +138,7 @@
/**
* {@inheritDoc}
*/
- @Test(enabled=false)
+ @Test()
@Override
public void testContainsEntry()
throws Exception
@@ -150,7 +151,7 @@
/**
* {@inheritDoc}
*/
- @Test(enabled=false)
+ @Test()
@Override
public void testGetEntry1()
throws Exception
@@ -163,7 +164,7 @@
/**
* {@inheritDoc}
*/
- @Test(enabled=false)
+ @Test()
@Override
public void testGetEntry2()
throws Exception
@@ -176,7 +177,7 @@
/**
* {@inheritDoc}
*/
- @Test(enabled=false)
+ @Test()
@Override
public void testGetEntry3()
throws Exception
@@ -189,7 +190,7 @@
/**
* {@inheritDoc}
*/
- @Test(enabled=false)
+ @Test()
@Override
public void testGetEntryID()
throws Exception
@@ -202,7 +203,7 @@
/**
* {@inheritDoc}
*/
- @Test(enabled=false)
+ @Test()
@Override
public void testPutEntry()
throws Exception
@@ -215,7 +216,7 @@
/**
* {@inheritDoc}
*/
- @Test(enabled=false)
+ @Test()
@Override
public void testPutEntryIfAbsent()
throws Exception
@@ -228,7 +229,7 @@
/**
* {@inheritDoc}
*/
- @Test(enabled=false)
+ @Test()
@Override
public void testRemoveEntry()
throws Exception
@@ -241,7 +242,7 @@
/**
* {@inheritDoc}
*/
- @Test(enabled=false)
+ @Test()
@Override
public void testClear()
throws Exception
@@ -254,7 +255,7 @@
/**
* {@inheritDoc}
*/
- @Test(enabled=false)
+ @Test()
@Override
public void testClearBackend()
throws Exception
@@ -267,7 +268,7 @@
/**
* {@inheritDoc}
*/
- @Test(enabled=false)
+ @Test()
@Override
public void testClearSubtree()
throws Exception
@@ -280,14 +281,14 @@
/**
* {@inheritDoc}
*/
- @Test(enabled=false)
+ @Test()
@Override
public void testHandleLowMemory()
throws Exception
{
- assertNull(super.cache.toVerboseString(),
- "Expected empty cache. " + "Cache contents:\n" +
- super.cache.toVerboseString());
+ assertNull(super.toVerboseString(),
+ "Expected empty cache. " + "Cache contents:" + ServerConstants.EOL +
+ super.toVerboseString());
Backend b = DirectoryServer.getBackend(DN.decode("o=test"));
@@ -303,7 +304,8 @@
assertFalse(super.cache.containsEntry(
super.testEntriesList.get(i).getDN()), "Not expected to find " +
super.testEntriesList.get(i).getDN().toString() + " in the " +
- "cache. Cache contents:\n" + super.cache.toVerboseString());
+ "cache. Cache contents:" + ServerConstants.EOL +
+ super.toVerboseString());
}
// Clear the cache so that other tests can start from scratch.
@@ -315,7 +317,7 @@
/**
* {@inheritDoc}
*/
- @Test(enabled=false, groups="slow",
+ @Test(groups="slow",
threadPoolSize = 10,
invocationCount = 10,
timeOut = 60000)
@@ -331,13 +333,13 @@
/**
* Tests cache rotation on specific number of entries.
*/
- @Test(enabled=false)
+ @Test()
public void testCacheRotation()
throws Exception
{
- assertNull(super.cache.toVerboseString(),
- "Expected empty cache. " + "Cache contents:\n" +
- super.cache.toVerboseString());
+ assertNull(super.toVerboseString(),
+ "Expected empty cache. " + "Cache contents:" + ServerConstants.EOL +
+ super.toVerboseString());
Backend b = DirectoryServer.getBackend(DN.decode("o=test"));
@@ -350,7 +352,8 @@
assertFalse(super.cache.containsEntry(
super.testEntriesList.get(i).getDN()), "Not expected to find " +
super.testEntriesList.get(i).getDN().toString() + " in the " +
- "cache. Cache contents:\n" + super.cache.toVerboseString());
+ "cache. Cache contents:" + ServerConstants.EOL +
+ super.toVerboseString());
}
// Make sure remaining NUMTESTENTRIES are still in the cache.
@@ -361,7 +364,8 @@
assertTrue(super.cache.containsEntry(
super.testEntriesList.get(i).getDN()), "Expected to find " +
super.testEntriesList.get(i).getDN().toString() + " in the " +
- "cache. Cache contents:\n" + super.cache.toVerboseString());
+ "cache. Cache contents:" + ServerConstants.EOL +
+ super.toVerboseString());
}
// Clear the cache so that other tests can start from scratch.
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/FileSystemEntryCacheTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/FileSystemEntryCacheTestCase.java
index 96cc93d..0308208 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/FileSystemEntryCacheTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/FileSystemEntryCacheTestCase.java
@@ -39,6 +39,7 @@
import org.opends.server.types.Attribute;
import org.opends.server.types.DN;
import org.opends.server.types.Entry;
+import org.opends.server.util.ServerConstants;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterGroups;
import org.testng.annotations.BeforeGroups;
@@ -105,9 +106,9 @@
super.cache.initializeEntryCache(configuration);
// Make sure the cache is empty.
- assertNull(super.cache.toVerboseString(),
- "Expected empty cache. " + "Cache contents:\n" +
- super.cache.toVerboseString());
+ assertNull(super.toVerboseString(),
+ "Expected empty cache. " + "Cache contents:" + ServerConstants.EOL +
+ super.toVerboseString());
}
@@ -150,9 +151,9 @@
super.cache.initializeEntryCache(configuration);
// Make sure the cache is empty.
- assertNull(super.cache.toVerboseString(),
- "Expected empty cache. " + "Cache contents:\n" +
- super.cache.toVerboseString());
+ assertNull(super.toVerboseString(),
+ "Expected empty cache. " + "Cache contents:" + ServerConstants.EOL +
+ super.toVerboseString());
}
@@ -262,7 +263,7 @@
/**
* {@inheritDoc}
*/
- @Test(enabled=false)
+ @Test()
@Override
public void testContainsEntry()
throws Exception
@@ -275,7 +276,7 @@
/**
* {@inheritDoc}
*/
- @Test(enabled=false)
+ @Test()
@Override
public void testGetEntry1()
throws Exception
@@ -288,7 +289,7 @@
/**
* {@inheritDoc}
*/
- @Test(enabled=false)
+ @Test()
@Override
public void testGetEntry2()
throws Exception
@@ -301,7 +302,7 @@
/**
* {@inheritDoc}
*/
- @Test(enabled=false)
+ @Test()
@Override
public void testGetEntry3()
throws Exception
@@ -314,7 +315,7 @@
/**
* {@inheritDoc}
*/
- @Test(enabled=false)
+ @Test()
@Override
public void testGetEntryID()
throws Exception
@@ -327,7 +328,7 @@
/**
* {@inheritDoc}
*/
- @Test(enabled=false)
+ @Test()
@Override
public void testPutEntry()
throws Exception
@@ -340,7 +341,7 @@
/**
* {@inheritDoc}
*/
- @Test(enabled=false)
+ @Test()
@Override
public void testPutEntryIfAbsent()
throws Exception
@@ -353,7 +354,7 @@
/**
* {@inheritDoc}
*/
- @Test(enabled=false)
+ @Test()
@Override
public void testRemoveEntry()
throws Exception
@@ -366,7 +367,7 @@
/**
* {@inheritDoc}
*/
- @Test(enabled=false)
+ @Test()
@Override
public void testClear()
throws Exception
@@ -379,7 +380,7 @@
/**
* {@inheritDoc}
*/
- @Test(enabled=false)
+ @Test()
@Override
public void testClearBackend()
throws Exception
@@ -392,7 +393,7 @@
/**
* {@inheritDoc}
*/
- @Test(enabled=false)
+ @Test()
@Override
public void testClearSubtree()
throws Exception
@@ -405,7 +406,7 @@
/**
* {@inheritDoc}
*/
- @Test(enabled=false)
+ @Test()
@Override
public void testHandleLowMemory()
throws Exception
@@ -418,7 +419,7 @@
/**
* {@inheritDoc}
*/
- @Test(enabled=false,groups="slow",
+ @Test(groups="slow",
threadPoolSize = 10,
invocationCount = 10,
// In case of disk based FS.
@@ -459,7 +460,7 @@
*
* @throws Exception If an unexpected problem occurs.
*/
- @Test(enabled=false, groups = { "slow", "testLRUCacheConcurrency" },
+ @Test(groups = { "slow", "testLRUCacheConcurrency" },
threadPoolSize = 10,
invocationCount = 10,
// In case of disk based FS.
@@ -475,13 +476,13 @@
/**
* Tests FIFO cache rotation on specific number of entries.
*/
- @Test(enabled=false, groups = "slow")
+ @Test(groups = "slow")
public void testCacheRotationFIFO()
throws Exception
{
- assertNull(super.cache.toVerboseString(),
- "Expected empty cache. " + "Cache contents:\n" +
- super.cache.toVerboseString());
+ assertNull(super.toVerboseString(),
+ "Expected empty cache. " + "Cache contents:" + ServerConstants.EOL +
+ super.toVerboseString());
// Put some test entries in the cache.
Backend b = DirectoryServer.getBackend(DN.decode("o=test"));
@@ -494,7 +495,8 @@
assertFalse(super.cache.containsEntry(
super.testEntriesList.get(i).getDN()), "Not expected to find " +
super.testEntriesList.get(i).getDN().toString() + " in the " +
- "cache. Cache contents:\n" + super.cache.toVerboseString());
+ "cache. Cache contents:" + ServerConstants.EOL +
+ super.toVerboseString());
}
// Make sure remaining NUMTESTENTRIES are still in the cache.
@@ -505,7 +507,8 @@
assertTrue(super.cache.containsEntry(
super.testEntriesList.get(i).getDN()), "Expected to find " +
super.testEntriesList.get(i).getDN().toString() + " in the " +
- "cache. Cache contents:\n" + super.cache.toVerboseString());
+ "cache. Cache contents:" + ServerConstants.EOL +
+ super.toVerboseString());
}
// Clear the cache so that other tests can start from scratch.
@@ -517,7 +520,7 @@
/**
* Tests LRU cache rotation on specific number of entries.
*/
- @Test(enabled=false, groups = "slow")
+ @Test(groups = "slow")
@SuppressWarnings("unchecked")
public void testCacheRotationLRU()
throws Exception
@@ -542,7 +545,8 @@
super.testEntriesList.get(i).getDN()),
"Expected to find " +
super.testEntriesList.get(i).getDN().toString() + " in the " +
- "cache. Cache contents:\n" + super.cache.toVerboseString());
+ "cache. Cache contents:" + ServerConstants.EOL +
+ super.toVerboseString());
}
// Plus the last cache entry added.
@@ -550,7 +554,8 @@
super.testEntriesList.get(super.NUMTESTENTRIES - 1).getDN()),
"Expected to find " +
super.testEntriesList.get(super.NUMTESTENTRIES - 1).getDN().toString() +
- " in the cache. Cache contents:\n" + super.cache.toVerboseString());
+ " in the cache. Cache contents:" + ServerConstants.EOL +
+ super.toVerboseString());
// And remaining NUMTESTENTRIES - 1 are now rotated.
for(int i = (super.MAXENTRIES - 1);
@@ -560,7 +565,8 @@
super.testEntriesList.get(i).getDN()),
"Not expected to find " +
super.testEntriesList.get(i).getDN().toString() + " in the " +
- "cache. Cache contents:\n" + super.cache.toVerboseString());
+ "cache. Cache contents:" + ServerConstants.EOL +
+ super.toVerboseString());
}
// Clear the cache so that other tests can start from scratch.
@@ -575,7 +581,7 @@
/**
* Tests cache persistence with consistent backend.
*/
- @Test(enabled=false, groups = "slow")
+ @Test(groups = "slow")
@SuppressWarnings("unchecked")
public void testCachePersistence()
throws Exception
@@ -608,7 +614,8 @@
super.testEntriesList.get(i).getDN()),
"Expected to find " +
super.testEntriesList.get(i).getDN().toString() + " in the " +
- "cache. Cache contents:\n" + super.cache.toVerboseString());
+ "cache. Cache contents:" + ServerConstants.EOL +
+ super.toVerboseString());
}
// Clear the cache so that other tests can start from scratch.
@@ -627,7 +634,7 @@
/**
* Tests cache persistence with inconsistent backend.
*/
- @Test(enabled=false, groups = "slow")
+ @Test(groups = "slow")
@SuppressWarnings("unchecked")
public void testCachePersistenceInconsistent()
throws Exception
@@ -673,7 +680,8 @@
super.testEntriesList.get(i).getDN()),
"Not expected to find " +
super.testEntriesList.get(i).getDN().toString() + " in the " +
- "cache. Cache contents:\n" + super.cache.toVerboseString());
+ "cache. Cache contents:" + ServerConstants.EOL +
+ super.toVerboseString());
}
// Clear the cache so that other tests can start from scratch.
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/SoftReferenceEntryCacheTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/SoftReferenceEntryCacheTestCase.java
index 055721f..271bc72 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/SoftReferenceEntryCacheTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/SoftReferenceEntryCacheTestCase.java
@@ -134,7 +134,7 @@
/**
* {@inheritDoc}
*/
- @Test(enabled=false)
+ @Test()
@Override
public void testContainsEntry()
throws Exception
@@ -147,7 +147,7 @@
/**
* {@inheritDoc}
*/
- @Test(enabled=false)
+ @Test()
@Override
public void testGetEntry1()
throws Exception
@@ -160,7 +160,7 @@
/**
* {@inheritDoc}
*/
- @Test(enabled=false)
+ @Test()
@Override
public void testGetEntry2()
throws Exception
@@ -173,7 +173,7 @@
/**
* {@inheritDoc}
*/
- @Test(enabled=false)
+ @Test()
@Override
public void testGetEntry3()
throws Exception
@@ -186,7 +186,7 @@
/**
* {@inheritDoc}
*/
- @Test(enabled=false)
+ @Test()
@Override
public void testGetEntryID()
throws Exception
@@ -199,7 +199,7 @@
/**
* {@inheritDoc}
*/
- @Test(enabled=false)
+ @Test()
@Override
public void testPutEntry()
throws Exception
@@ -212,7 +212,7 @@
/**
* {@inheritDoc}
*/
- @Test(enabled=false)
+ @Test()
@Override
public void testPutEntryIfAbsent()
throws Exception
@@ -225,7 +225,7 @@
/**
* {@inheritDoc}
*/
- @Test(enabled=false)
+ @Test()
@Override
public void testRemoveEntry()
throws Exception
@@ -238,7 +238,7 @@
/**
* {@inheritDoc}
*/
- @Test(enabled=false)
+ @Test()
@Override
public void testClear()
throws Exception
@@ -251,7 +251,7 @@
/**
* {@inheritDoc}
*/
- @Test(enabled=false)
+ @Test()
@Override
public void testClearBackend()
throws Exception
@@ -264,7 +264,7 @@
/**
* {@inheritDoc}
*/
- @Test(enabled=false)
+ @Test()
@Override
public void testClearSubtree()
throws Exception
@@ -277,12 +277,12 @@
/**
* {@inheritDoc}
*/
- @Test(enabled=false)
+ @Test()
@Override
public void testHandleLowMemory()
throws Exception
{
- super.cache.handleLowMemory();
+ super.testHandleLowMemory();
}
@@ -290,7 +290,7 @@
/**
* {@inheritDoc}
*/
- @Test(enabled=false, groups="slow",
+ @Test(groups="slow",
threadPoolSize = 10,
invocationCount = 10,
timeOut = 60000)
--
Gitblit v1.10.0