[jbosscache-commits] JBoss Cache SVN: r7305 - core/trunk/src/test/java/org/jboss/cache.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Fri Dec 12 03:49:20 EST 2008


Author: mircea.markus
Date: 2008-12-12 03:49:20 -0500 (Fri, 12 Dec 2008)
New Revision: 7305

Modified:
   core/trunk/src/test/java/org/jboss/cache/AbstractMultipleCachesTest.java
   core/trunk/src/test/java/org/jboss/cache/AbstractSingleCacheTest.java
   core/trunk/src/test/java/org/jboss/cache/CallbackTest.java
   core/trunk/src/test/java/org/jboss/cache/FqnTest.java
   core/trunk/src/test/java/org/jboss/cache/GetKeysTest.java
   core/trunk/src/test/java/org/jboss/cache/GlobalTransactionTest.java
   core/trunk/src/test/java/org/jboss/cache/UnitTestCacheFactory.java
Log:
removed System.out.print

Modified: core/trunk/src/test/java/org/jboss/cache/AbstractMultipleCachesTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/AbstractMultipleCachesTest.java	2008-12-12 08:48:42 UTC (rev 7304)
+++ core/trunk/src/test/java/org/jboss/cache/AbstractMultipleCachesTest.java	2008-12-12 08:49:20 UTC (rev 7305)
@@ -1,9 +1,6 @@
 package org.jboss.cache;
 
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeTest;
+import org.testng.annotations.*;
 import org.jboss.cache.util.TestingUtil;
 
 import java.util.Set;
@@ -13,24 +10,25 @@
 /**
  * @author Mircea.Markus at jboss.com
  */
+ at Test(groups = {"functional", "unit"})
 public abstract class AbstractMultipleCachesTest<K, V> extends AbstractCacheTest<K,V>
 {
    protected Set<CacheSPI<K, V>> caches = new HashSet<CacheSPI<K,V>>();
 
-   @BeforeTest
+   @BeforeClass
    public void create() throws Throwable
    {
       createCaches();
    }
 
    @AfterClass
-   public void destroy()
+   protected void destroy()
    {
       TestingUtil.killCaches(caches.toArray(new Cache[caches.size()]));
    }
 
    @AfterMethod
-   public void clearContent() throws Throwable
+   protected void clearContent() throws Throwable
    {
       for (CacheSPI<K, V> cache : caches)
       {
@@ -40,7 +38,7 @@
 
    protected abstract void createCaches() throws Throwable;
 
-   public void registerCaches(Cache... caches)
+   final protected void registerCaches(Cache... caches)
    {
       for (Cache c: caches) this.caches.add((CacheSPI<K, V>) c);
    }

Modified: core/trunk/src/test/java/org/jboss/cache/AbstractSingleCacheTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/AbstractSingleCacheTest.java	2008-12-12 08:48:42 UTC (rev 7304)
+++ core/trunk/src/test/java/org/jboss/cache/AbstractSingleCacheTest.java	2008-12-12 08:49:20 UTC (rev 7305)
@@ -3,32 +3,34 @@
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.AfterClass;
+import org.testng.annotations.Test;
 import org.jboss.cache.util.TestingUtil;
 
 /**
  * @author Mircea.Markus at jboss.com
  */
+ at Test(groups = {"functional", "unit"})
 public abstract class AbstractSingleCacheTest<K, V> extends AbstractCacheTest<K, V>
 {
    protected CacheSPI<K, V> cache;
 
    @BeforeClass
-   public void create()
+   protected void create()
    {
       cache = createCache();
    }
 
    @AfterClass
-   public void destroy()
+   protected void destroy()
    {
       TestingUtil.killCaches(cache);
    }
 
    @AfterMethod
-   public void clearContent()
+   protected void clearContent()
    {
       super.clearContent(cache);
    }
 
-   public abstract CacheSPI<K, V> createCache();
+   protected abstract CacheSPI<K, V> createCache();
 }

Modified: core/trunk/src/test/java/org/jboss/cache/CallbackTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/CallbackTest.java	2008-12-12 08:48:42 UTC (rev 7304)
+++ core/trunk/src/test/java/org/jboss/cache/CallbackTest.java	2008-12-12 08:49:20 UTC (rev 7305)
@@ -42,7 +42,6 @@
       cache.put(FQN_A, null);
       assertTrue(cache.exists(FQN_A));
       assertTrue(cache.exists(FQN_B));//created by callback
-      System.out.println("cache locks:\n" + CachePrinter.printCacheLockingInfo(cache));
       assertEquals(0, cache.getNumberOfLocksHeld());
    }
 
@@ -53,7 +52,6 @@
 
       cache.put(FQN_A, null);
       assertTrue(cache.exists(FQN_A));
-      System.out.println("cache locks:\n" + CachePrinter.printCacheLockingInfo(cache));
       assertEquals(0, cache.getNumberOfLocksHeld());
    }
 
@@ -66,7 +64,6 @@
       cache.put("/a", null);
       assertTrue(cache.exists(FQN_A));
       assertTrue(cache.exists(FQN_B));
-      System.out.println("cache locks:\n" + CachePrinter.printCacheLockingInfo(cache));
       assertEquals(0, cache.getNumberOfLocksHeld());
    }
 
@@ -185,9 +182,7 @@
             {
                if (!c.exists(FQN_B))
                {
-                  System.out.println("PutListener: creating node " + FQN_B);
                   c.put(FQN_B, KEY, VALUE);
-                  System.out.println("PutListener: created node " + FQN_B);
                }
             }
             catch (CacheException ex)

Modified: core/trunk/src/test/java/org/jboss/cache/FqnTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/FqnTest.java	2008-12-12 08:48:42 UTC (rev 7304)
+++ core/trunk/src/test/java/org/jboss/cache/FqnTest.java	2008-12-12 08:49:20 UTC (rev 7305)
@@ -53,7 +53,6 @@
    public void testNull()
    {
       Fqn fqn = Fqn.ROOT;
-      log("null fqn is " + fqn);
       assert 0 == fqn.size();
       int hcode = fqn.hashCode();
       assert hcode != -1;
@@ -62,7 +61,6 @@
    public void testOne()
    {
       Fqn fqn = Fqn.fromElements(22);
-      log("one fqn is " + fqn);
       assert 1 == fqn.size();
       int hcode = fqn.hashCode();
       assert hcode != -1;
@@ -78,11 +76,9 @@
    public void testFqn()
    {
       Fqn fqn = Fqn.fromString("/a/b/c");
-      log("fqn is " + fqn);
       assert 3 == fqn.size();
 
       Fqn fqn2 = Fqn.fromElements("a", "b", "c");
-      log("fqn2 is " + fqn2);
       assert 3 == fqn.size();
       assert fqn.equals(fqn2);
       assert fqn.hashCode() == fqn2.hashCode();
@@ -91,7 +87,6 @@
    public void testHereogeneousNames()
    {
       Fqn fqn = Fqn.fromElements("string", 38, true);
-      log("fqn is " + fqn);
       assert 3 == fqn.size();
 
       Fqn fqn2 = Fqn.fromElements("string", 38, true);
@@ -104,7 +99,6 @@
       Fqn fqn1, fqn2;
       fqn1 = Fqn.fromElements("a", "b", "c");
       fqn2 = Fqn.fromString("/a/b/c");
-      log("fqn is " + fqn1);
       assert fqn1.equals(fqn2);
 
       HashMap<Fqn, Integer> map = new HashMap<Fqn, Integer>();
@@ -385,11 +379,6 @@
       }
    }
 
-   void log(String msg)
-   {
-      System.out.println("-- " + msg);
-   }
-
    public void testReplacingDirectAncestor()
    {
       Fqn fqn = Fqn.fromString("/a/b/c");

Modified: core/trunk/src/test/java/org/jboss/cache/GetKeysTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/GetKeysTest.java	2008-12-12 08:48:42 UTC (rev 7304)
+++ core/trunk/src/test/java/org/jboss/cache/GetKeysTest.java	2008-12-12 08:49:20 UTC (rev 7305)
@@ -43,7 +43,6 @@
       cache.put("/a/b/c", "city", "Kreuzlingen");
 
       Set keys = cache.getNode("/a/b/c").getKeys();
-      log("keys are " + keys);
       assertNotNull(keys);
       assertEquals(3, keys.size());
 
@@ -62,7 +61,6 @@
       cache.put("/a/b/c/3", null);
 
       Set children = cache.getNode("/a/b/c").getChildrenNames();
-      log("children are " + children);
       assertNotNull(children);
       assertEquals(3, children.size());
 
@@ -89,9 +87,4 @@
          //expected
       }
    }
-
-   void log(String msg)
-   {
-      System.out.println("-- " + msg);
-   }
 }

Modified: core/trunk/src/test/java/org/jboss/cache/GlobalTransactionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/GlobalTransactionTest.java	2008-12-12 08:48:42 UTC (rev 7304)
+++ core/trunk/src/test/java/org/jboss/cache/GlobalTransactionTest.java	2008-12-12 08:49:20 UTC (rev 7305)
@@ -37,7 +37,6 @@
       tx1 = GlobalTransaction.create(a1);
       tx2 = GlobalTransaction.create(a1);
 
-      System.out.println("\ntx1: " + tx1 + "\ntx2: " + tx2);
       assertTrue(tx1.equals(tx2) == false);
 
       tx2 = tx1;
@@ -50,7 +49,6 @@
    {
       IpAddress a1 = new IpAddress("localhost", 4444);
       GlobalTransaction tx1 = GlobalTransaction.create(a1);
-      System.out.println("\ntx1: " + tx1);
       assertFalse(tx1.equals(Thread.currentThread()));
    }
 
@@ -59,7 +57,6 @@
    {
       IpAddress a1 = new IpAddress("localhost", 4444);
       GlobalTransaction tx1 = GlobalTransaction.create(a1);
-      System.out.println("\ntx1: " + tx1);
       assertFalse(tx1.equals(null));
    }
 
@@ -73,7 +70,6 @@
       tx1 = GlobalTransaction.create(a1);
       tx2 = GlobalTransaction.create(a1);
 
-      System.out.println("\ntx1: " + tx1 + "\ntx2: " + tx2);
       assertTrue(tx1.equals(tx2) == false);
 
       int hcode_1 = tx1.hashCode();
@@ -114,9 +110,6 @@
       tx1_copy = (GlobalTransaction) in.readObject();
       tx2_copy = (GlobalTransaction) in.readObject();
 
-      System.out.println("\ntx1: " + tx1 + ", tx1_copy: " + tx1_copy +
-            "\ntx2: " + tx2 + ", tx2_copy: " + tx2_copy);
-
       assertNotNull(tx1_copy);
       assertNotNull(tx2_copy);
       assertEquals(tx1, tx1_copy);
@@ -165,10 +158,4 @@
       assertFalse(tx1.equals(tx2));
       assertFalse(tx2.equals(tx1));
    }
-
-
-   void log(String msg)
-   {
-      System.out.println("-- [" + Thread.currentThread() + "]: " + msg);
-   }
 }

Modified: core/trunk/src/test/java/org/jboss/cache/UnitTestCacheFactory.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/UnitTestCacheFactory.java	2008-12-12 08:48:42 UTC (rev 7304)
+++ core/trunk/src/test/java/org/jboss/cache/UnitTestCacheFactory.java	2008-12-12 08:49:20 UTC (rev 7305)
@@ -114,7 +114,6 @@
       }
       catch (ConfigurationException e)
       {
-         System.out.println("Detected legacy configuration file format when parsing [" + configFileName + "].  Migrating to the new (3.x) file format is recommended.  See FAQs for details.");
          XmlConfigurationParser2x oldParser = new XmlConfigurationParser2x();
          c = oldParser.parseFile(configFileName);
       }
@@ -140,12 +139,6 @@
 
    public Cache<K, V> createCache(Configuration configuration, boolean start, Class ownerClass) throws ConfigurationException
    {
-      // - Do not print out this exception - since tests are ALSO run from IDEs on the main thread. - MANIK
-//      if (!Thread.currentThread().getName().contains("pool"))
-//      {
-//         System.out.println("CreateCache called from wrong thread: " + Thread.currentThread().getName());
-//      }
-
       checkCaches(ownerClass);
       tryMCastAddress();
 
@@ -227,10 +220,9 @@
          {
             caches.remove(c);
             allCaches.remove(c);
-         }
-         else if (allCaches.contains(c))
+         } else if (allCaches.contains(c))
          {
-            System.out.println("[" + Thread.currentThread().getName() + "] WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Remove cache called from different thread.");
+            System.err.println("[" + Thread.currentThread().getName() + "] WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Remove cache called from different thread.");
             Thread.dumpStack();
          }
       }
@@ -254,18 +246,7 @@
       if (clusterName.indexOf(Thread.currentThread().getName()) == -1)
       {
          clusterName = clusterName + "-" + Thread.currentThread().getName();
-//       System.out.println(getThreadId() + " Setting cluster name " + newClusterName);
       }
-
-//      String testName = extractTestName();
-
-      // prepend test name
-      /*
-      if (clusterName.indexOf(testName) == -1) {
-         clusterName = testName + "-" + clusterName;
-      }
-      */
-
       configuration.setClusterName(clusterName);
 
    }
@@ -300,10 +281,8 @@
       {
          String origAddr = m.group().substring(m.group().indexOf("=") + 1);
          String newAddr = threadMcastIP.get();
-//         System.out.println(getThreadId() + " Replacing mcast_addr " + origAddr + " with " + newAddr);
          clusterConfig = m.replaceFirst("mcast_addr=" + newAddr);
-      }
-      else
+      } else
       {
          Thread.dumpStack();
          System.exit(1);
@@ -316,7 +295,6 @@
       {
 //         String origPort = m.group().substring(m.group().indexOf("=") + 1);
          String newPort = threadMcastPort.get().toString();
-         //       System.out.println(getThreadId() + " Replacing mcast_port " + origPort + " with " + newPort);
          clusterConfig = m.replaceFirst("mcast_port=" + newPort);
       }
 
@@ -342,9 +320,9 @@
 
          if (cleanUp())
          {
-            System.out.print(threadId + "WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ");
-            System.out.print(threadId + " A test method in " + lastTestClass + " did not clean all cache instances properly. ");
-            System.out.println(threadId + " Use UnitTestCacheFactory.cleanUp() or TestngUtil.killCaches(...) ");
+            System.err.print(threadId + "WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ");
+            System.err.print(threadId + " A test method in " + lastTestClass + " did not clean all cache instances properly. ");
+            System.err.println(threadId + " Use UnitTestCacheFactory.cleanUp() or TestngUtil.killCaches(...) ");
          }
 
       }




More information about the jbosscache-commits mailing list