[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/buddyreplication ...
Manik Surtani
msurtani at jboss.com
Wed Sep 6 11:30:57 EDT 2006
User: msurtani
Date: 06/09/06 11:30:57
Modified: tests/functional/org/jboss/cache/buddyreplication
BuddyAssignmentStateTransferTest.java
BuddyBackupActivationInactivationTest.java
BuddyGroupAssignmentTest.java
BuddyPoolBroadcastTest.java
BuddyReplicationConfigTest.java
BuddyReplicationContentTest.java
BuddyReplicationFailoverTest.java
BuddyReplicationTestsBase.java
Log:
Removed TreeCache dependency on ServiceMBeanSupport
Revision Changes Path
1.8 +150 -149 JBossCache/tests/functional/org/jboss/cache/buddyreplication/BuddyAssignmentStateTransferTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: BuddyAssignmentStateTransferTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/buddyreplication/BuddyAssignmentStateTransferTest.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- BuddyAssignmentStateTransferTest.java 20 Jul 2006 10:31:21 -0000 1.7
+++ BuddyAssignmentStateTransferTest.java 6 Sep 2006 15:30:57 -0000 1.8
@@ -21,6 +21,7 @@
{
protected int timeout = 10000; // !!!
+
protected int getSleepTimeout()
{
return timeout;
@@ -58,7 +59,7 @@
assertNull("State not transferred", caches[2].get(test, "name"));
// Make 2 the buddy of 0
- caches[1].stopService();
+ caches[1].stop();
caches[1] = null;
TestingUtil.sleepThread(getSleepTimeout());
@@ -86,9 +87,9 @@
caches[0].getConfiguration().setUseRegionBasedMarshalling(true);
caches[1].getConfiguration().setUseRegionBasedMarshalling(true);
caches[2].getConfiguration().setUseRegionBasedMarshalling(true);
- caches[0].startService();
- caches[1].startService();
- caches[2].startService();
+ caches[0].start();
+ caches[1].start();
+ caches[2].start();
TestingUtil.blockUntilViewsReceived(caches, VIEW_BLOCK_TIMEOUT);
TestingUtil.sleepThread(getSleepTimeout());
@@ -117,7 +118,7 @@
assertNull("No backup of /d", caches[2].get(testD, "name"));
// Make 2 the buddy of 0
- caches[1].stopService();
+ caches[1].stop();
caches[1] = null;
TestingUtil.sleepThread(getSleepTimeout());
@@ -144,7 +145,7 @@
caches[0] = createCacheWithCacheLoader(tmpLoc0, false, false, false, true, false);
caches[0].getConfiguration().setFetchInMemoryState(false);
- caches[0].startService();
+ caches[0].start();
Fqn main = Fqn.fromString("/a/b/c");
caches[0].put(main, "name", "Joe");
@@ -152,7 +153,7 @@
caches[1] = createCacheWithCacheLoader(tmpLoc1, false, false, false, true, false);
caches[1].getConfiguration().setFetchInMemoryState(false);
- caches[1].startService();
+ caches[1].start();
TestingUtil.blockUntilViewsReceived(caches, VIEW_BLOCK_TIMEOUT);
TestingUtil.sleepThread(getSleepTimeout());
1.8 +54 -51 JBossCache/tests/functional/org/jboss/cache/buddyreplication/BuddyBackupActivationInactivationTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: BuddyBackupActivationInactivationTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/buddyreplication/BuddyBackupActivationInactivationTest.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- BuddyBackupActivationInactivationTest.java 20 Jul 2006 11:14:17 -0000 1.7
+++ BuddyBackupActivationInactivationTest.java 6 Sep 2006 15:30:57 -0000 1.8
@@ -115,13 +115,14 @@
if (caches.get(cacheID) != null)
throw new IllegalStateException(cacheID + " already created");
- TreeCache tree=new TreeCache();
+ TreeCache tree = new TreeCache();
String configFile = sync ? "META-INF/replSync-service.xml"
: "META-INF/replAsync-service.xml";
tree.setConfiguration(new XmlConfigurationParser().parseFile(configFile));
tree.getConfiguration().setClusterName("Test");
- if (useMarshalling) {
+ if (useMarshalling)
+ {
tree.getConfiguration().setUseRegionBasedMarshalling(true);
tree.getConfiguration().setInactiveOnStartup(true);
}
@@ -132,8 +133,8 @@
if (startCache)
{
- tree.createService();
- tree.startService();
+ tree.create();
+ tree.start();
}
return tree;
@@ -169,11 +170,13 @@
{
if (cache != null)
{
- try {
- cache.stopService();
- cache.destroyService();
+ try
+ {
+ cache.stop();
+ cache.destroy();
}
- catch (Exception e) {
+ catch (Exception e)
+ {
System.out.println("Exception stopping cache " + e.getMessage());
e.printStackTrace(System.out);
}
1.10 +122 -122 JBossCache/tests/functional/org/jboss/cache/buddyreplication/BuddyGroupAssignmentTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: BuddyGroupAssignmentTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/buddyreplication/BuddyGroupAssignmentTest.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- BuddyGroupAssignmentTest.java 26 May 2006 12:58:57 -0000 1.9
+++ BuddyGroupAssignmentTest.java 6 Sep 2006 15:30:57 -0000 1.10
@@ -21,7 +21,7 @@
{
TreeCache[] caches = createCaches(3, false);
- for (int i=0; i<caches.length; i++)
+ for (int i = 0; i < caches.length; i++)
{
printBuddyGroup(caches[i]);
}
@@ -77,7 +77,7 @@
assertIsBuddy(caches[2], caches[0], true);
// now remove a cache from the cluster
- caches[1].stopService();
+ caches[1].stop();
caches[1] = null;
TestingUtil.sleepThread(getSleepTimeout());
@@ -117,7 +117,7 @@
assertIsBuddy(caches[3], caches[1], false);
// now remove a cache from the cluster
- caches[1].stopService();
+ caches[1].stop();
caches[1] = null;
TestingUtil.sleepThread(getSleepTimeout());
1.13 +176 -175 JBossCache/tests/functional/org/jboss/cache/buddyreplication/BuddyPoolBroadcastTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: BuddyPoolBroadcastTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/buddyreplication/BuddyPoolBroadcastTest.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- BuddyPoolBroadcastTest.java 11 May 2006 12:28:10 -0000 1.12
+++ BuddyPoolBroadcastTest.java 6 Sep 2006 15:30:57 -0000 1.13
@@ -21,17 +21,17 @@
{
private void checkConsistentPoolState(TreeCache[] caches)
{
- for (int i=0; i<caches.length; i++)
+ for (int i = 0; i < caches.length; i++)
{
Map groupMap = caches[i].getBuddyManager().buddyPool;
- for (int j = 0; j<caches.length; j++)
+ for (int j = 0; j < caches.length; j++)
{
if (i != j)
{
Map groupMap2 = caches[j].getBuddyManager().buddyPool;
- for (int k=0; k<caches.length; k++)
+ for (int k = 0; k < caches.length; k++)
{
- assertEquals("Comparing contents of cache " + (i+1) + " pool map with cache " + (j+1), groupMap.get(caches[k]), groupMap2.get(caches[k]));
+ assertEquals("Comparing contents of cache " + (i + 1) + " pool map with cache " + (j + 1), groupMap.get(caches[k]), groupMap2.get(caches[k]));
}
}
}
@@ -113,7 +113,7 @@
// now test against each other
checkConsistentPoolState(caches);
- caches[1].stopService();
+ caches[1].stop();
caches[1] = createCache(1, "Z");
TestingUtil.blockUntilViewsReceived(caches, VIEW_BLOCK_TIMEOUT);
@@ -142,7 +142,7 @@
Latch latch = new Latch();
CacheStarter[] starters = new CacheStarter[numCaches];
- for (int i=0; i<numCaches; i++)
+ for (int i = 0; i < numCaches; i++)
{
caches[i] = createCache(1, new String(new char[]{(char) ('A' + i)}), false, false);
starters[i] = new CacheStarter(latch, caches[i]);
@@ -159,7 +159,7 @@
// and now look at the state of things.
Map map = caches[0].getBuddyManager().buddyPool;
- for (int i=0; i<numCaches; i++)
+ for (int i = 0; i < numCaches; i++)
{
assertEquals("Failed on cache " + i, new String(new char[]{(char) ('A' + i)}), map.get(caches[i].getLocalAddress()));
}
@@ -183,12 +183,13 @@
this.latch = latch;
this.cache = cache;
}
+
public void run()
{
try
{
latch.acquire();
- cache.startService();
+ cache.start();
}
catch (Exception e)
{
1.7 +59 -59 JBossCache/tests/functional/org/jboss/cache/buddyreplication/BuddyReplicationConfigTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: BuddyReplicationConfigTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/buddyreplication/BuddyReplicationConfigTest.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- BuddyReplicationConfigTest.java 20 Jul 2006 11:14:17 -0000 1.6
+++ BuddyReplicationConfigTest.java 6 Sep 2006 15:30:57 -0000 1.7
@@ -49,8 +49,8 @@
assertTrue(mgr.isEnabled());
assertNull(mgr.getBuddyPoolName());
assertEquals(NextMemberBuddyLocator.class, mgr.buddyLocator.getClass());
- assertEquals(1, ((NextMemberBuddyLocator)mgr.buddyLocator).numBuddies);
- assertTrue(((NextMemberBuddyLocator)mgr.buddyLocator).ignoreColocatedBuddies);
+ assertEquals(1, ((NextMemberBuddyLocator) mgr.buddyLocator).numBuddies);
+ assertTrue(((NextMemberBuddyLocator) mgr.buddyLocator).ignoreColocatedBuddies);
}
public void testXmlConfig() throws Exception
@@ -58,7 +58,7 @@
TreeCache cache = new TreeCache();
cache.setConfiguration(new XmlConfigurationParser().parseFile("META-INF/buddyreplication-service.xml"));
- cache.createService();
+ cache.create();
BuddyManager bm = cache.getBuddyManager();
assertNotNull(bm);
1.10 +188 -189 JBossCache/tests/functional/org/jboss/cache/buddyreplication/BuddyReplicationContentTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: BuddyReplicationContentTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/buddyreplication/BuddyReplicationContentTest.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- BuddyReplicationContentTest.java 25 May 2006 09:56:12 -0000 1.9
+++ BuddyReplicationContentTest.java 6 Sep 2006 15:30:57 -0000 1.10
@@ -21,7 +21,7 @@
private void assertNoStaleLocks(TreeCache[] caches)
{
- for (int i=0; i<caches.length; i++) assertNoStaleLocks(caches[i]);
+ for (int i = 0; i < caches.length; i++) assertNoStaleLocks(caches[i]);
}
private void assertNoStaleLocks(TreeCache cache)
@@ -45,7 +45,6 @@
assertNoStaleLocks(caches);
-
// this should be in neither of the other caches' "main" trees
assertEquals(value, caches[0].get(fqn, key));
assertNull("Should be null", caches[1].get(fqn, key));
@@ -60,7 +59,7 @@
}
finally
{
- cleanup( caches );
+ cleanup(caches);
}
}
@@ -111,7 +110,7 @@
}
finally
{
- cleanup( caches );
+ cleanup(caches);
}
}
@@ -164,7 +163,7 @@
}
finally
{
- cleanup( caches );
+ cleanup(caches);
}
}
@@ -231,8 +230,8 @@
}
finally
{
- if (cache2 != null) cache2.stopService();
- cleanup( caches );
+ if (cache2 != null) cache2.stop();
+ cleanup(caches);
}
}
@@ -249,7 +248,7 @@
TestingUtil.sleepThread(getSleepTimeout());
- caches[2].stopService();
+ caches[2].stop();
System.out.println("*** " + caches[0].printLockInfo());
System.out.println("*** " + caches[1].printLockInfo());
@@ -262,7 +261,7 @@
TestingUtil.sleepThread(getSleepTimeout());
- caches[1].stopService();
+ caches[1].stop();
// cache[0] is all thats left!!
1.16 +184 -185 JBossCache/tests/functional/org/jboss/cache/buddyreplication/BuddyReplicationFailoverTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: BuddyReplicationFailoverTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/buddyreplication/BuddyReplicationFailoverTest.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- BuddyReplicationFailoverTest.java 2 Jun 2006 15:26:49 -0000 1.15
+++ BuddyReplicationFailoverTest.java 6 Sep 2006 15:30:57 -0000 1.16
@@ -6,8 +6,8 @@
*/
package org.jboss.cache.buddyreplication;
-import org.jboss.cache.TreeCache;
import org.jboss.cache.Fqn;
+import org.jboss.cache.TreeCache;
import org.jboss.cache.config.Option;
import org.jboss.cache.misc.TestingUtil;
@@ -70,7 +70,7 @@
if (killOwner)
{
- caches[0].stopService();
+ caches[0].stop();
caches[0] = null;
TestingUtil.sleepThread(500);
}
@@ -159,7 +159,6 @@
Fqn backupFqn2 = Fqn.fromString("/" + BuddyManager.BUDDY_BACKUP_SUBTREE + "/" + BuddyManager.getGroupNameFromAddress(caches[0].getLocalAddress()) + "/test/subtree");
-
caches[0].put(fqn, key, value);
caches[0].put(fqn2, key, value);
@@ -200,7 +199,7 @@
assertTrue(!caches[1].exists(newBackupFqn));
assertTrue(!caches[1].exists(newBackupFqn2));
- for (int i=0; i<caches.length; i++)
+ for (int i = 0; i < caches.length; i++)
{
assertTrue(!caches[i].exists(backupFqn));
assertTrue(!caches[i].exists(backupFqn2));
1.29 +239 -239 JBossCache/tests/functional/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: BuddyReplicationTestsBase.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- BuddyReplicationTestsBase.java 14 Aug 2006 17:52:35 -0000 1.28
+++ BuddyReplicationTestsBase.java 6 Sep 2006 15:30:57 -0000 1.29
@@ -7,11 +7,11 @@
package org.jboss.cache.buddyreplication;
import junit.framework.TestCase;
-import org.jboss.cache.TreeCache;
-import org.jboss.cache.Fqn;
import org.jboss.cache.CacheException;
-import org.jboss.cache.config.Option;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.TreeCache;
import org.jboss.cache.config.Configuration;
+import org.jboss.cache.config.Option;
import org.jboss.cache.misc.TestingUtil;
import org.jboss.cache.xml.XmlHelper;
@@ -60,13 +60,13 @@
String xmlString = "<config><buddyReplicationEnabled>true</buddyReplicationEnabled>\n" +
"<buddyCommunicationTimeout>600000</buddyCommunicationTimeout>\n" +
" <buddyLocatorClass>org.jboss.cache.buddyreplication.NextMemberBuddyLocator</buddyLocatorClass>\n" +
- " <autoDataGravitation>"+useDataGravitation+"</autoDataGravitation>\n" +
- " <dataGravitationRemoveOnFind>"+removeOnFind+"</dataGravitationRemoveOnFind>\n" +
- " <buddyLocatorProperties>numBuddies = "+numBuddies+"</buddyLocatorProperties>\n";
+ " <autoDataGravitation>" + useDataGravitation + "</autoDataGravitation>\n" +
+ " <dataGravitationRemoveOnFind>" + removeOnFind + "</dataGravitationRemoveOnFind>\n" +
+ " <buddyLocatorProperties>numBuddies = " + numBuddies + "</buddyLocatorProperties>\n";
- if (buddyPoolName != null) xmlString += "<buddyPoolName>"+buddyPoolName+"</buddyPoolName>";
+ if (buddyPoolName != null) xmlString += "<buddyPoolName>" + buddyPoolName + "</buddyPoolName>";
xmlString += "</config>";
- c.getConfiguration().setBuddyReplicationConfig( XmlHelper.stringToElement(xmlString) );
+ c.getConfiguration().setBuddyReplicationConfig(XmlHelper.stringToElement(xmlString));
c.getConfiguration().setFetchInMemoryState(true);
if (optimisticLocks)
@@ -77,7 +77,7 @@
c.getConfiguration().setSyncCommitPhase(true); // helps track down breakages
if (start)
- c.startService();
+ c.start();
return c;
}
@@ -107,7 +107,7 @@
tmpLoc += File.separator + "BuddyReplicationTestsBase-";
TreeCache[] caches = new TreeCache[numCaches];
- for (int i=0; i< numCaches; i++)
+ for (int i = 0; i < numCaches; i++)
{
caches[i] = createCacheWithCacheLoader((tmpLoc + i), useDataGravitation, removeOnFind, passivation, fetchPersistent, true);
}
@@ -123,21 +123,21 @@
TreeCache cache = createCache(1, null, useDataGravitation, removeOnFind, false);
String cloader = "<config>\n" +
- "<passivation>"+passivation+"</passivation>\n" +
+ "<passivation>" + passivation + "</passivation>\n" +
"<preload></preload>\n" +
"<cacheloader>\n" +
"<class>org.jboss.cache.loader.FileCacheLoader</class>\n" +
- "<properties>location=" +(location)+ "</properties>\n" +
+ "<properties>location=" + (location) + "</properties>\n" +
"<async>false</async>\n" +
"<shared>false</shared>\n" +
- "<fetchPersistentState>"+ fetchPersistent + "</fetchPersistentState>\n" +
+ "<fetchPersistentState>" + fetchPersistent + "</fetchPersistentState>\n" +
"</cacheloader>\n" +
"</config>";
cache.getConfiguration().setCacheLoaderConfiguration(XmlHelper.stringToElement(cloader));
if (start)
- cache.startService();
+ cache.start();
return cache;
}
@@ -155,7 +155,7 @@
protected TreeCache[] createCaches(int numBuddies, int numCaches, boolean useBuddyPool, boolean useDataGravitation, boolean optimisticLocks) throws Exception
{
TreeCache[] caches = new TreeCache[numCaches];
- for (int i=0; i<numCaches; i++)
+ for (int i = 0; i < numCaches; i++)
{
caches[i] = createCache(optimisticLocks, numBuddies, useBuddyPool ? Character.toString((char) ('A' + i)) : null, useDataGravitation, true);
}
@@ -175,7 +175,7 @@
if (caches != null)
{
- for (int i=0; i<caches.length;i++)
+ for (int i = 0; i < caches.length; i++)
{
if (caches[i] != null)
{
@@ -189,7 +189,7 @@
{
e.printStackTrace(System.out);
}
- caches[i].stopService();
+ caches[i].stop();
}
catch (Exception e)
{
@@ -243,7 +243,7 @@
protected void dumpCacheContents(TreeCache[] caches)
{
System.out.println("**** START: Cache Contents ****");
- for (int i=0; i<caches.length; i++)
+ for (int i = 0; i < caches.length; i++)
{
if (caches[i] == null)
System.out.println(" ** Cache " + i + " is null!");
@@ -258,7 +258,7 @@
protected void assertNoLocks(TreeCache[] caches)
{
- for (int i=0;i<caches.length; i++)
+ for (int i = 0; i < caches.length; i++)
{
if (caches[i] != null) assertEquals(0, caches[i].getNumberOfLocksHeld());
}
More information about the jboss-cvs-commits
mailing list