[jbosscache-commits] JBoss Cache SVN: r7301 - core/trunk/src/test/java/org/jboss/cache/replicated.
jbosscache-commits at lists.jboss.org
jbosscache-commits at lists.jboss.org
Fri Dec 12 03:44:07 EST 2008
Author: mircea.markus
Date: 2008-12-12 03:44:07 -0500 (Fri, 12 Dec 2008)
New Revision: 7301
Modified:
core/trunk/src/test/java/org/jboss/cache/replicated/AsyncReplTest.java
core/trunk/src/test/java/org/jboss/cache/replicated/PessimisticSyncReplTxTest.java
core/trunk/src/test/java/org/jboss/cache/replicated/ReplicationExceptionTest.java
core/trunk/src/test/java/org/jboss/cache/replicated/SyncCacheListenerTest.java
core/trunk/src/test/java/org/jboss/cache/replicated/SyncReplTest.java
Log:
removed System.out.print
Modified: core/trunk/src/test/java/org/jboss/cache/replicated/AsyncReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/replicated/AsyncReplTest.java 2008-12-12 08:43:28 UTC (rev 7300)
+++ core/trunk/src/test/java/org/jboss/cache/replicated/AsyncReplTest.java 2008-12-12 08:44:07 UTC (rev 7301)
@@ -46,11 +46,9 @@
{
AsyncReplTestTL tl = new AsyncReplTestTL();
threadLocal.set(tl);
- log("creating cache1");
tl.cache1 = createCache("CacheGroup");
tl.replListener1 = ReplicationListener.getReplicationListener(tl.cache1);
- log("creating cache2");
tl.cache2 = createCache("CacheGroup");
tl.replListener2 = ReplicationListener.getReplicationListener(tl.cache2);
}
@@ -199,7 +197,6 @@
{
cache1.put("a/b/c", "age", 38);
cache4 = createCache("CacheGroup");
- System.out.println("" + cache4.getMembers());
assertEquals(3, cache4.getMembers().size());// cache1, cache2 and cache4
assertEquals("\"age\" should be 38", 38, cache4.get("/a/b/c", "age"));
}
@@ -211,7 +208,6 @@
{
if (cache4 != null)
{
- System.out.println("cache4's view: " + cache4.getMembers());
cache4.stop();
}
}
@@ -232,7 +228,6 @@
// value on cache2 may be 38 or not yet replicated
age = (Integer) cache2.get("/a/b/c", "age");
- log("attr \"age\" of \"/a/b/c\" on cache2=" + age);
assertTrue("should be either null or 38", age == null || age == 38);
}
catch (Exception e)
@@ -259,7 +254,6 @@
// value on cache2 may be 38 or not yet replicated
age = (Integer) cache2.get("/a/b/c", "age");
- log("attr \"age\" of \"/a/b/c\" on cache2=" + age);
assertTrue("should be either null or 38", age == null || age == 38);
}
catch (Exception e)
@@ -267,9 +261,4 @@
fail(e.toString());
}
}
-
- private void log(String msg)
- {
- System.out.println("-- [" + Thread.currentThread() + "]: " + msg);
- }
}
Modified: core/trunk/src/test/java/org/jboss/cache/replicated/PessimisticSyncReplTxTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/replicated/PessimisticSyncReplTxTest.java 2008-12-12 08:43:28 UTC (rev 7300)
+++ core/trunk/src/test/java/org/jboss/cache/replicated/PessimisticSyncReplTxTest.java 2008-12-12 08:44:07 UTC (rev 7301)
@@ -204,7 +204,6 @@
tm = beginTransaction();
cache1.put(NODE1, "age", 38);
- System.out.println("TransactionTable for cache1 after cache1.put():\n" + cache1.getTransactionTable().toString(true));
tm.commit();
/*
@@ -212,7 +211,6 @@
cache1.put(NODE1, "age", new Integer(38));
cache1.put(NODE2, "name", "Ben of The Far East");
cache1.put(NODE3, "key", "UnknowKey");
- System.out.println("TransactionTable for cache1 after cache1.put():\n" + cache1.getTransactionTable().toString(true));
tx.commit();
*/
@@ -224,7 +222,6 @@
cache1.put(NODE2, "AOPInstance", new AOPInstance());
cache1.put(NODE1, "AOPInstance", new AOPInstance());
tx.commit();
- System.out.println("TransactionTable for cache1 after cache1.put():\n" + cache1.getTransactionTable().toString(true));
*/
}
@@ -245,14 +242,9 @@
tm = beginTransaction();
cache1.put(NODE1, "age", 38);
- System.out.println("TransactionTable for cache1 after cache1.put():\n" + cache1.getTransactionTable().toString(true));
cache2.put(NODE2, "age", 39);
- System.out.println("TransactionTable for cache2 after cache2.put():\n" + cache2.getTransactionTable().toString(true));
- System.out.println("cache1 before commit:\n" + CachePrinter.printCacheLockingInfo(cache1));
- System.out.println("cache2 before commit:\n" + CachePrinter.printCacheLockingInfo(cache2));
-
try
{
tm.commit();
@@ -263,9 +255,6 @@
//should be a classic deadlock here.
}
- System.out.println("cache1 after commit:\n" + CachePrinter.printCacheLockingInfo(cache1));
- System.out.println("cache2 after commit:\n" + CachePrinter.printCacheLockingInfo(cache2));
-
/*
assertTrue(cache1.exists(NODE1));
assertTrue(cache1.exists(NODE2));
@@ -291,8 +280,6 @@
assertEquals(0, cache1.getNumberOfLocksHeld());
assertEquals(0, cache2.getNumberOfLocksHeld());
- System.out.println("TransactionTable for cache1:\n" + cache1.getTransactionTable().toString(true));
- System.out.println("TransactionTable for cache2:\n" + cache2.getTransactionTable().toString(true));
}
public void testSyncReplWithModficationsOnBothCachesSameData() throws Exception
@@ -302,14 +289,9 @@
initCaches(Configuration.CacheMode.REPL_SYNC);
tm = beginTransaction();
cache1.put(NODE, "age", 38);
- System.out.println("TransactionTable for cache1 after cache1.put():\n" + cache1.getTransactionTable().toString(true));
cache2.put(NODE, "age", 39);
- System.out.println("TransactionTable for cache2 after cache2.put():\n" + cache2.getTransactionTable().toString(true));
- System.out.println("cache1 before commit:\n" + CachePrinter.printCacheLockingInfo(cache1));
- System.out.println("cache2 before commit:\n" + CachePrinter.printCacheLockingInfo(cache2));
-
try
{
tm.commit();
@@ -317,12 +299,8 @@
}
catch (RollbackException rollback)
{
- System.out.println("Transaction was rolled back, this is correct");
}
- System.out.println("cache1 after commit:\n" + CachePrinter.printCacheLockingInfo(cache1));
- System.out.println("cache2 after commit:\n" + CachePrinter.printCacheLockingInfo(cache2));
-
assertEquals(0, cache1.getNumberOfLocksHeld());
assertEquals(0, cache2.getNumberOfLocksHeld());
@@ -345,9 +323,6 @@
cache1.put(fqn1, "age", 38);
cache2.put(fqn2, "age", 39);
- System.out.println("cache1 (before commit):\n" + CachePrinter.printCacheLockingInfo(cache1));
- System.out.println("cache2 (before commit):\n" + CachePrinter.printCacheLockingInfo(cache2));
-
// this will rollback the transaction
Transaction tx = tm.getTransaction();
tx.registerSynchronization(new TransactionAborter(tx));
@@ -359,12 +334,8 @@
}
catch (RollbackException rollback)
{
- System.out.println("Transaction was rolled back, this is correct");
}
- System.out.println("cache1 (after rollback):\n" + CachePrinter.printCacheLockingInfo(cache1));
- System.out.println("cache2 (after rollback):\n" + CachePrinter.printCacheLockingInfo(cache2));
-
assertEquals(0, cache1.getNumberOfLocksHeld());
assertEquals(0, cache2.getNumberOfLocksHeld());
@@ -394,9 +365,6 @@
tm = beginTransaction();
cache1.put(NODE1, "age", 38);
- System.out.println("cache1 (before commit):\n" + CachePrinter.printCacheLockingInfo(cache1));
- System.out.println("cache2 (before commit):\n" + CachePrinter.printCacheLockingInfo(cache2));
-
// instead of a listener lets just get a WL on ROOT on cache2. And hold on to it.
Transaction tx = tm.suspend();
@@ -404,7 +372,6 @@
cache2.getRoot().put("x", "y");
Transaction tx2 = cache2.getTransactionManager().suspend();
- System.out.println("cache2 (before commit):\n" + CachePrinter.printCacheLockingInfo(cache2));
tm.resume(tx);
try
@@ -414,7 +381,6 @@
}
catch (RollbackException rollback)
{
- System.out.println("Transaction was rolled back, this is correct");
}
finally
{
@@ -425,9 +391,6 @@
// Sleep, as the commit call to cache2 is async
TestingUtil.sleepThread(1000);
- System.out.println("cache1 (after rollback):\n" + CachePrinter.printCacheLockingInfo(cache1));
- System.out.println("cache2 (after rollback):\n" + CachePrinter.printCacheLockingInfo(cache2));
-
//assertNull(tal.getCallbackException());
assertEquals(0, cache1.getNumberOfLocksHeld());
@@ -512,8 +475,6 @@
cache1.put("/bela/ban", "name", "Bela Ban");
TestingUtil.sleepThread(2000);// Thread2 will be blocked until we commit
tm.commit();
- System.out.println("[Thread1] ** LOCK INFO cache1: " + CachePrinter.printCacheLockingInfo(cache1));
- System.out.println("[Thread1] ** LOCK INFO cache2: " + CachePrinter.printCacheLockingInfo(cache2));
}
catch (Throwable ex)
{
@@ -533,14 +494,8 @@
{
TestingUtil.sleepThread(1000);// give Thread1 time to acquire the lock
tm = beginTransaction();
- System.out.println("[Thread2] ** LOCK INFO cache1: " + CachePrinter.printCacheLockingInfo(cache1));
- System.out.println("[Thread2] ** LOCK INFO cache2: " + CachePrinter.printCacheLockingInfo(cache2));
cache1.put("/bela/ban", "name", "Michelle Ban");
- System.out.println("[Thread2] ** LOCK INFO cache1: " + CachePrinter.printCacheLockingInfo(cache1));
- System.out.println("[Thread2] ** LOCK INFO cache2: " + CachePrinter.printCacheLockingInfo(cache2));
tm.commit();
- System.out.println("[Thread2] ** LOCK INFO cache1: " + CachePrinter.printCacheLockingInfo(cache1));
- System.out.println("[Thread2] ** LOCK INFO cache2: " + CachePrinter.printCacheLockingInfo(cache2));
}
catch (Throwable ex)
{
@@ -635,15 +590,11 @@
{
tm = beginTransaction(c1);
c1.put("/thread/" + getName(), null);
- System.out.println("Thread " + getName() + " after put(): " + c1.toString());
- System.out.println("Thread " + getName() + " waiting on mutex");
synchronized (mutex)
{
mutex.wait();
}
- System.out.println("Thread " + getName() + " committing");
tm.commit();
- System.out.println("Thread " + getName() + " committed successfully");
}
catch (Exception e)
{
@@ -672,15 +623,12 @@
for (int i = 0; i < threads.length; i++)
{
MyThread thread = threads[i];
- System.out.println("starting thread #" + i);
thread.start();
}
TestingUtil.sleepThread(6000);
synchronized (myMutex)
{
- System.out.println("cache is " + CachePrinter.printCacheLockingInfo(c1));
- System.out.println("******************* SIGNALLING THREADS ********************");
myMutex.notifyAll();
}
@@ -689,7 +637,6 @@
try
{
thread.join();
- System.out.println("Joined thread " + thread.getName());
}
catch (InterruptedException e)
{
@@ -697,7 +644,6 @@
}
}
- System.out.println("FINAL c1:\n" + CachePrinter.printCacheDetails(c1) + "\nlocks:\n" + CachePrinter.printCacheLockingInfo(c1));
assertEquals(0, c1.getNumberOfLocksHeld());
assertEquals(0, c2.getNumberOfLocksHeld());
@@ -764,7 +710,6 @@
}
catch (RollbackException rollback_ex)
{
- System.out.println("received rollback exception as expected");
}
catch (Throwable ex)
{
@@ -805,21 +750,15 @@
try
{
lock.acquire();
- System.out.println("-- t1 has lock");
c1.put("/a/b/c", "age", 38);
- System.out.println("[Thread1] set value to 38");
- System.out.println("-- t1 releases lock");
lock.release();
TestingUtil.sleepThread(300);
Thread.yield();
lock.acquire();
- System.out.println("-- t1 has lock");
c1.put("/a/b/c", "age", 39);
- System.out.println("[Thread1] set value to 39");
- System.out.println("-- t1 releases lock");
lock.release();
assertEquals(39, c1.get("/a/b/c", "age"));
}
@@ -844,20 +783,15 @@
TestingUtil.sleepThread(100);
Thread.yield();
lock.acquire();
- System.out.println("-- t2 has lock");
// Should replicate the value right away.
Integer val = (Integer) cache2.get("/a/b/c", "age");
- System.out.println("[Thread2] value is " + val);
assertEquals(new Integer(38), val);
- System.out.println("-- t2 releases lock");
lock.release();
TestingUtil.sleepThread(300);
Thread.yield();
TestingUtil.sleepThread(500);
lock.acquire();
- System.out.println("-- t2 has lock");
val = (Integer) cache2.get("/a/b/c", "age");
- System.out.println("-- t2 releases lock");
lock.release();
assertEquals(new Integer(39), val);
}
@@ -963,7 +897,6 @@
}
catch (RollbackException ex)
{
- System.out.println("[Thread1] received RollbackException, as expected. Rolling back changes");
} finally
{
threadOneSecondPart.release();
Modified: core/trunk/src/test/java/org/jboss/cache/replicated/ReplicationExceptionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/replicated/ReplicationExceptionTest.java 2008-12-12 08:43:28 UTC (rev 7300)
+++ core/trunk/src/test/java/org/jboss/cache/replicated/ReplicationExceptionTest.java 2008-12-12 08:44:07 UTC (rev 7301)
@@ -120,12 +120,8 @@
catch (RuntimeException runtime)
{
Throwable t = runtime.getCause();
- if (t instanceof NotSerializableException)
+ if (! (t instanceof NotSerializableException))
{
- System.out.println("received NotSerializableException - as expected");
- }
- else
- {
throw runtime;
}
}
@@ -148,7 +144,6 @@
}
catch (RollbackException rollback)
{
- System.out.println("received RollbackException - as expected");
}
catch (Exception e)
{
Modified: core/trunk/src/test/java/org/jboss/cache/replicated/SyncCacheListenerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/replicated/SyncCacheListenerTest.java 2008-12-12 08:43:28 UTC (rev 7300)
+++ core/trunk/src/test/java/org/jboss/cache/replicated/SyncCacheListenerTest.java 2008-12-12 08:44:07 UTC (rev 7301)
@@ -49,19 +49,16 @@
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
- System.out.println("*** starting setUp()");
//old_factory = System.getProperty(Context.INITIAL_CONTEXT_FACTORY);
System.setProperty(Context.INITIAL_CONTEXT_FACTORY, FACTORY);
initCaches();
- System.out.println("*** finished setUp()");
}
@AfterMethod(alwaysRun = true)
public void tearDown() throws Exception
{
- System.out.println("*** starting tearDown()");
- // We just can't kill DummyTransactionManager. We are sharing single instance in more tests.
+ // We just can't kill DummyTransactionManager. We are sharing single instance in more tests.
TestingUtil.killTransaction(DummyTransactionManager.getInstance());
destroyCaches();
/*
@@ -71,7 +68,6 @@
old_factory = null;
}
*/
- System.out.println("*** finished tearDown()");
}
private void initCaches()
@@ -247,7 +243,6 @@
@NodeModified
public void callback(NodeEvent e)
{
- System.out.println("Callback got event " + e);
log_.debug("Callback got event " + e);
assertFalse("node was removed on remote cache so isLocal should be false", e.isOriginLocal());
}
Modified: core/trunk/src/test/java/org/jboss/cache/replicated/SyncReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/replicated/SyncReplTest.java 2008-12-12 08:43:28 UTC (rev 7300)
+++ core/trunk/src/test/java/org/jboss/cache/replicated/SyncReplTest.java 2008-12-12 08:44:07 UTC (rev 7301)
@@ -32,13 +32,11 @@
@BeforeMethod(alwaysRun = true)
public void setUp()
{
- System.out.println("*** In setUp()");
Cache<Object, Object>[] caches = new Cache[2];
caches[0] = new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), getClass());
caches[1] = new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), getClass());
cachesTL.set(caches);
TestingUtil.blockUntilViewsReceived(caches, 5000);
- System.out.println("*** Finished setUp()");
}
@AfterMethod(alwaysRun = true)
More information about the jbosscache-commits
mailing list