From ce9a47597a234d664049ac75fa9cc6ab0911c85a Mon Sep 17 00:00:00 2001
From: abobrov <abobrov@localhost>
Date: Fri, 24 Aug 2007 16:25:51 +0000
Subject: [PATCH] - add assertions covering cache maps out of sync. - replace atomic init followed by clear in favor of before/after group to improve concurrency. - fix FIFO rotation test bug to assert for all rotated entries.
---
opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/FIFOEntryCacheTestCase.java | 29 ++++++++++++++++++++++++++---
1 files changed, 26 insertions(+), 3 deletions(-)
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 a981896..513034a 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
@@ -39,6 +39,8 @@
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;
import org.testng.annotations.Test;
import static org.testng.Assert.*;
@@ -314,10 +316,31 @@
+ @BeforeGroups(groups = "testFIFOCacheConcurrency")
+ public void cacheConcurrencySetup()
+ throws Exception
+ {
+ assertNull(super.toVerboseString(),
+ "Expected empty cache. " + "Cache contents:" + ServerConstants.EOL +
+ super.toVerboseString());
+ }
+
+
+
+ @AfterGroups(groups = "testFIFOCacheConcurrency")
+ public void cacheConcurrencyCleanup()
+ throws Exception
+ {
+ // Clear the cache so that other tests can start from scratch.
+ super.cache.clear();
+ }
+
+
+
/**
* {@inheritDoc}
*/
- @Test(groups="slow",
+ @Test(groups = { "slow", "testFIFOCacheConcurrency" },
threadPoolSize = 10,
invocationCount = 10,
timeOut = 60000)
@@ -347,8 +370,8 @@
super.cache.putEntry(super.testEntriesList.get(i), b, i);
}
- // Make sure first MAXENTRIES out of NUMTESTENTRIES rotated.
- for(int i = 0; i < super.MAXENTRIES; i++ ) {
+ // Make sure first NUMTESTENTRIES - MAXENTRIES got rotated.
+ for(int i = 0; i < (super.NUMTESTENTRIES - super.MAXENTRIES); i++ ) {
assertFalse(super.cache.containsEntry(
super.testEntriesList.get(i).getDN()), "Not expected to find " +
super.testEntriesList.get(i).getDN().toString() + " in the " +
--
Gitblit v1.10.0