[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/eviction ...
Manik Surtani
msurtani at jboss.com
Fri Aug 25 10:55:08 EDT 2006
User: msurtani
Date: 06/08/25 10:55:08
Modified: tests/functional/org/jboss/cache/eviction
ReplicatedLRUPolicyTest.java
Log:
Fixed problem in setUp()
Revision Changes Path
1.12 +33 -30 JBossCache/tests/functional/org/jboss/cache/eviction/ReplicatedLRUPolicyTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ReplicatedLRUPolicyTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/eviction/ReplicatedLRUPolicyTest.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- ReplicatedLRUPolicyTest.java 16 Aug 2006 10:52:51 -0000 1.11
+++ ReplicatedLRUPolicyTest.java 25 Aug 2006 14:55:07 -0000 1.12
@@ -14,7 +14,7 @@
{
TreeCache cache_, cache1_, cache2_;
int wakeupIntervalMillis_ = 0;
- EvictionListener listener_ ;
+ EvictionListener listener_;
public ReplicatedLRUPolicyTest(String s)
{
@@ -27,25 +27,23 @@
super.setUp();
cache_ = new TreeCache();
initCaches(cache_);
-// cache1_ = new TreeCache();
-// initCaches(cache1_);
cache_.getConfiguration().setUseRegionBasedMarshalling(true);
+ cache_.startService();
cache_.getNotifier().addCacheListener(listener_);
listener_.resetCounter();
- cache_.startService();
-// cache1_.startService();
- // cache2 doesn't have eviction policy
cache2_ = new TreeCache();
cache2_.setConfiguration(new XmlConfigurationParser().parseFile("META-INF/replSync-service.xml")); // read in generic local xml
cache2_.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
cache2_.getConfiguration().setUseRegionBasedMarshalling(true);
cache2_.startService();
- wakeupIntervalMillis_ = cache_.getEvictionThreadWakeupIntervalSeconds() *1000;
- log("wakeupInterval is " +wakeupIntervalMillis_);
- if(wakeupIntervalMillis_ <=0)
- fail("testEviction(): eviction thread wake up interval is illegal " +wakeupIntervalMillis_);
+ 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
@@ -64,52 +62,57 @@
/**
* Test local eviction policy that failed for eviction event.
*/
- public void testBasic() throws Exception {
+ public void testBasic() throws Exception
+ {
String rootStr = "/org/jboss/test/data/";
- String str = rootStr +"0";
+ String str = rootStr + "0";
cache_.put(str, str, str);
TestingUtil.sleepThread(30000);
- String val = (String)cache_.get(str, str);
+ String val = (String) cache_.get(str, str);
assertNull("DataNode should be evicted already ", val);
assertEquals("Eviction counter ", 1, listener_.getCounter());
- val = (String)cache2_.get(str, str);
+ val = (String) cache2_.get(str, str);
assertNotNull("DataNode should not be evicted here ", val);
assertEquals("Eviction counter ", 1, listener_.getCounter());
}
- public void testEviction() throws Exception {
+ public void testEviction() throws Exception
+ {
String rootStr = "/org/jboss/test/data/";
- for(int i=0; i < 10; i++) {
- String str = rootStr +i;
+ for (int i = 0; i < 10; i++)
+ {
+ String str = rootStr + i;
Fqn fqn = Fqn.fromString(str);
cache_.put(fqn, str, str);
}
- TestingUtil.sleepThread(2 *wakeupIntervalMillis_);
- String val = (String)cache_.get(rootStr +"3", rootStr+"3");
+ TestingUtil.sleepThread(2 * wakeupIntervalMillis_);
+ String val = (String) cache_.get(rootStr + "3", rootStr + "3");
assertNull("DataNode should be evicted already ", val);
- val = (String)cache2_.get(rootStr +"3", rootStr+"3");
+ val = (String) cache2_.get(rootStr + "3", rootStr + "3");
assertNotNull("DataNode should not be evicted here ", val);
}
- public void testEvictionReplication() throws Exception {
+ public void testEvictionReplication() throws Exception
+ {
String rootStr = "/org/jboss/test/data/";
- for(int i=0; i < 10; i++) {
- String str = rootStr +i;
+ for (int i = 0; i < 10; i++)
+ {
+ String str = rootStr + i;
Fqn fqn = Fqn.fromString(str);
cache_.put(fqn, str, str);
}
- TestingUtil.sleepThread(wakeupIntervalMillis_ -1000);
- String str = rootStr +"7";
+ TestingUtil.sleepThread(wakeupIntervalMillis_ - 1000);
+ String str = rootStr + "7";
Fqn fqn = Fqn.fromString(str);
cache_.get(fqn, str);
TestingUtil.sleepThread(wakeupIntervalMillis_);
- String val = (String)cache_.get(rootStr +"3", rootStr+"3");
+ String val = (String) cache_.get(rootStr + "3", rootStr + "3");
assertNull("DataNode should be empty ", val);
- val = (String)cache2_.get(rootStr +"7", rootStr+"7");
+ val = (String) cache2_.get(rootStr + "7", rootStr + "7");
assertNotNull("DataNode should not be null", val);
}
@@ -132,7 +135,7 @@
public void nodeEvicted(Fqn fqn, boolean pre, boolean isLocal)
{
- if(pre) counter++;
+ if (pre) counter++;
}
}
}
More information about the jboss-cvs-commits
mailing list