[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/misc ...
Manik Surtani
msurtani at belmont.prod.atl2.jboss.com
Tue Aug 29 12:35:52 EDT 2006
User: msurtani
Date: 06/08/29 12:35:52
Modified: tests/functional/org/jboss/cache/misc TestingUtil.java
Log:
Fixed basic replication issues
Revision Changes Path
1.8 +76 -66 JBossCache/tests/functional/org/jboss/cache/misc/TestingUtil.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: TestingUtil.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/misc/TestingUtil.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- TestingUtil.java 20 Jul 2006 16:22:06 -0000 1.7
+++ TestingUtil.java 29 Aug 2006 16:35:52 -0000 1.8
@@ -7,10 +7,12 @@
package org.jboss.cache.misc;
+import org.jboss.cache.Cache;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.TreeCache;
import java.util.List;
+
/**
* Utilities for unit testing JBossCache.
*
@@ -26,11 +28,10 @@
*
* @param caches caches which must all have consistent views
* @param timeout max number of ms to loop
- *
* @throws RuntimeException if <code>timeout</code> ms have elapse without
* all caches having the same number of members.
*/
- public static void blockUntilViewsReceived(CacheSPI[] caches, long timeout)
+ public static void blockUntilViewsReceived(Cache[] caches, long timeout)
{
long failTime = System.currentTimeMillis() + timeout;
@@ -38,8 +39,10 @@
{
sleepThread(100);
if (areCacheViewsComplete(caches))
+ {
return;
}
+ }
throw new RuntimeException("timed out before caches had complete views");
}
@@ -50,7 +53,6 @@
*
* @param caches caches which must all have consistent views
* @param timeout max number of ms to loop
- *
* @throws RuntimeException if <code>timeout</code> ms have elapse without
* all caches having the same number of members.
*/
@@ -62,8 +64,10 @@
{
sleepThread(100);
if (areCacheViewsComplete(caches))
+ {
return;
}
+ }
throw new RuntimeException("timed out before caches had complete views");
}
@@ -74,7 +78,6 @@
*
* @param groupSize number of caches expected in the group
* @param timeout max number of ms to loop
- *
* @throws RuntimeException if <code>timeout</code> ms have elapse without
* all caches having the same number of members.
*/
@@ -86,8 +89,10 @@
{
sleepThread(100);
if (isCacheViewComplete(cache, groupSize))
+ {
return;
}
+ }
throw new RuntimeException("timed out before caches had complete views");
}
@@ -98,7 +103,6 @@
*
* @param groupSize number of caches expected in the group
* @param timeout max number of ms to loop
- *
* @throws RuntimeException if <code>timeout</code> ms have elapse without
* all caches having the same number of members.
*/
@@ -110,8 +114,10 @@
{
sleepThread(100);
if (isCacheViewComplete(cache, groupSize))
+ {
return;
}
+ }
throw new RuntimeException("timed out before caches had complete views");
}
@@ -124,19 +130,20 @@
* @param caches caches that should form a View
* @return <code>true</code> if all caches have
* <code>caches.length</code> members; false otherwise
- *
* @throws IllegalStateException if any of the caches have MORE view
* members than caches.length
*/
- public static boolean areCacheViewsComplete(CacheSPI[] caches)
+ public static boolean areCacheViewsComplete(Cache[] caches)
{
int memberCount = caches.length;
for (int i = 0; i < memberCount; i++)
{
if (!isCacheViewComplete(caches[i], memberCount))
+ {
return false;
}
+ }
return true;
}
@@ -149,7 +156,6 @@
* @param caches caches that should form a View
* @return <code>true</code> if all caches have
* <code>caches.length</code> members; false otherwise
- *
* @throws IllegalStateException if any of the caches have MORE view
* members than caches.length
*/
@@ -167,7 +173,6 @@
}
/**
- *
* @param cache
* @param memberCount
*/
@@ -191,7 +196,9 @@
for (int j = 0; j < members.size(); j++)
{
if (j > 0)
+ {
sb.append(", ");
+ }
sb.append(members.get(j));
}
sb.append(')');
@@ -203,12 +210,12 @@
}
/**
- *
* @param cache
* @param memberCount
*/
- public static boolean isCacheViewComplete(CacheSPI cache, int memberCount)
+ public static boolean isCacheViewComplete(Cache c, int memberCount)
{
+ CacheSPI cache = (CacheSPI) c;
List members = cache.getMembers();
if (members == null || memberCount > members.size())
{
@@ -227,7 +234,9 @@
for (int j = 0; j < members.size(); j++)
{
if (j > 0)
+ {
sb.append(", ");
+ }
sb.append(members.get(j));
}
sb.append(')');
@@ -239,7 +248,6 @@
}
-
/**
* Puts the current thread to sleep for the desired number of ms, suppressing
* any exceptions.
@@ -252,6 +260,8 @@
{
Thread.sleep(sleeptime);
}
- catch (InterruptedException ie) {}
+ catch (InterruptedException ie)
+ {
+ }
}
}
More information about the jboss-cvs-commits
mailing list