[jbosscache-commits] JBoss Cache SVN: r5004 - cache-bench-fwk/trunk/src/org/cachebench/tests.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Sat Jan 5 18:33:10 EST 2008


Author: mircea.markus
Date: 2008-01-05 18:33:10 -0500 (Sat, 05 Jan 2008)
New Revision: 5004

Modified:
   cache-bench-fwk/trunk/src/org/cachebench/tests/ReplicationOccursTest.java
Log:
increased the memory size for the JVM

Modified: cache-bench-fwk/trunk/src/org/cachebench/tests/ReplicationOccursTest.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/ReplicationOccursTest.java	2008-01-05 23:24:50 UTC (rev 5003)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/ReplicationOccursTest.java	2008-01-05 23:33:10 UTC (rev 5004)
@@ -6,10 +6,11 @@
 import org.cachebench.TestResult;
 import org.cachebench.cluster.ClusterBarrier;
 import org.cachebench.config.Configuration;
+import org.cachebench.config.TestCase;
 import org.cachebench.config.TestConfig;
-import org.cachebench.config.TestCase;
 
 import java.net.SocketAddress;
+import java.util.Collection;
 import java.util.Map;
 
 /**
@@ -126,8 +127,30 @@
       log.info("Number of caches that replicated here is " + replicaCount);
       if (isPartialReplication(testCaseName, testName))
       {
-         return replicaCount > 0;
+         return verifyClusterReplication(replicaCount);
       }
       return replicaCount == conf.getClusterConfig().getClusterSize() - 1;
    }
+
+   /**
+    * Checks whether the sum of replciations across the cluster is bigger than the number of nodes in the cluster, in
+    * other words each node replicated at least once.
+    */
+   private boolean verifyClusterReplication(int replicaCount) throws Exception
+   {
+      ClusterBarrier barrier = new ClusterBarrier();
+      barrier.setConfig(conf.getClusterConfig());
+      barrier.barrier(replicaCount);
+      Collection recievedValues = barrier.getReceivedMessages().values();
+      log.trace("Recieved the following repilcation counts: " + recievedValues);
+      int totalValue = 0;
+      for (Object val : recievedValues)
+      {
+         totalValue += Integer.valueOf(val.toString());
+      }
+      log.info("Overall replication count is: " + totalValue);
+      boolean isReplicationSuccess = totalValue >= this.conf.getClusterConfig().getClusterSize();
+      log.info("Is replication passed? " + isReplicationSuccess);
+      return isReplicationSuccess;
+   }
 }




More information about the jbosscache-commits mailing list