[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/passivation ...
Manik Surtani
msurtani at jboss.com
Mon Sep 4 17:06:18 EDT 2006
User: msurtani
Date: 06/09/04 17:06:18
Modified: tests/functional/org/jboss/cache/passivation
LocalPassivationIntegrationTest.java
Log:
Fixed passivation bugs
Revision Changes Path
1.7 +43 -24 JBossCache/tests/functional/org/jboss/cache/passivation/LocalPassivationIntegrationTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: LocalPassivationIntegrationTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/passivation/LocalPassivationIntegrationTest.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- LocalPassivationIntegrationTest.java 16 Aug 2006 10:52:52 -0000 1.6
+++ LocalPassivationIntegrationTest.java 4 Sep 2006 21:06:18 -0000 1.7
@@ -16,6 +16,8 @@
import org.jboss.cache.factories.XmlConfigurationParser;
import org.jboss.cache.misc.TestingUtil;
+import java.util.Map;
+
/**
* @author Ben Wang, Feb 11, 2004
*/
@@ -24,7 +26,7 @@
TreeCache cache_;
protected final static Log log = LogFactory.getLog(LocalPassivationIntegrationTest.class);
int wakeupIntervalMillis_ = 0;
- PassivationListener listener_ ;
+ PassivationListener listener_;
public LocalPassivationIntegrationTest(String s)
{
@@ -38,15 +40,18 @@
cache_ = new TreeCache();
initCaches(cache_);
cache_.getConfiguration().setUseRegionBasedMarshalling(true);
- cache_.getNotifier().addCacheListener(listener_);
- listener_.resetCounter();
cache_.startService();
- wakeupIntervalMillis_ = cache_.getEvictionThreadWakeupIntervalSeconds() *1000;
- log("wakeupInterval is " +wakeupIntervalMillis_);
- if(wakeupIntervalMillis_ <=0)
- fail("testEviction(): eviction thread wake up interval is illegal " +wakeupIntervalMillis_);
+ cache_.getNotifier().addCacheListener(listener_);
+ listener_.resetCounter();
+
+ wakeupIntervalMillis_ = cache_.getEvictionThreadWakeupIntervalSeconds() * 1000;
+ log("wakeupInterval is " + wakeupIntervalMillis_);
+ if (wakeupIntervalMillis_ <= 0)
+ {
+ fail("testEviction(): eviction thread wake up interval is illegal " + wakeupIntervalMillis_);
+ }
}
void initCaches(TreeCache cache) throws Exception
@@ -63,9 +68,10 @@
/**
*/
- public void testActivationEvent() throws Exception {
+ public void testActivationEvent() throws Exception
+ {
String rootStr = "/org/jboss/test/data/";
- String str = rootStr +"0";
+ String str = rootStr + "0";
cache_.remove("/");
listener_.resetCounter();
@@ -73,7 +79,7 @@
TestingUtil.sleepThread(20000);
assertFalse("NodeImpl should not exist", cache_.exists(str, str));
- String val = (String)cache_.get(str, str);
+ String val = (String) cache_.get(str, str);
assertNotNull("DataNode should be activated ", val);
assertEquals("Eviction counter ", 1, listener_.getCounter());
}
@@ -86,20 +92,33 @@
class PassivationListener extends AbstractCacheListener
{
int counter = 0;
+ int loadedCounter = 0;
public int getCounter()
- { return counter; }
+ {
+ return counter;
+ }
public void resetCounter()
{
counter = 0;
+ loadedCounter = 0;
}
- public void nodeActivated(Fqn fqn, boolean pre) {
- if(!pre)
+ public void nodeActivated(Fqn fqn, boolean pre)
+ {
+ if (!pre)
{
counter++;
- log.info("nodeActivate(): counter: " +counter);
+ log.info("nodeActivate(): counter: " + counter);
+ }
+ }
+
+ public void nodeLoaded(Fqn f, boolean pre, Map data)
+ {
+ if (!pre)
+ {
+ loadedCounter++;
}
}
More information about the jboss-cvs-commits
mailing list