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

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Mon Oct 1 08:25:58 EDT 2007


Author: manik.surtani at jboss.com
Date: 2007-10-01 08:25:58 -0400 (Mon, 01 Oct 2007)
New Revision: 4521

Modified:
   core/trunk/src/test/java/org/jboss/cache/statetransfer/FailedStateTransferTest.java
   core/trunk/src/test/java/org/jboss/cache/statetransfer/ForcedStateTransferTest.java
   core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransfer200Test.java
   core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferCompatibilityTest.java
   core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferConcurrencyTest.java
   core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferTestBase.java
Log:
Annotated to run as TestNG tests - these were missed for some reason.

Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/FailedStateTransferTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/FailedStateTransferTest.java	2007-10-01 09:24:57 UTC (rev 4520)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/FailedStateTransferTest.java	2007-10-01 12:25:58 UTC (rev 4521)
@@ -22,22 +22,24 @@
 
 package org.jboss.cache.statetransfer;
 
-import static org.testng.AssertJUnit.fail;
-
-import java.io.InputStream;
-
 import org.jboss.cache.CacheException;
 import org.jboss.cache.CacheImpl;
 import org.jboss.cache.Version;
 import org.jboss.cache.config.Configuration.CacheMode;
 import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
 import org.jboss.cache.lock.TimeoutException;
+import static org.testng.AssertJUnit.fail;
+import org.testng.annotations.Test;
+
+import java.io.InputStream;
+
 /**
  * A FailedStateTransferTest.
  *
  * @author Brian Stansberry
  * @version $Revision$
  */
+ at Test(groups = {"functional"})
 public class FailedStateTransferTest extends StateTransferTestBase
 {
 

Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/ForcedStateTransferTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/ForcedStateTransferTest.java	2007-10-01 09:24:57 UTC (rev 4520)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/ForcedStateTransferTest.java	2007-10-01 12:25:58 UTC (rev 4521)
@@ -22,15 +22,6 @@
 
 package org.jboss.cache.statetransfer;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
-
-import javax.transaction.Synchronization;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
 import org.jboss.cache.CacheException;
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.Fqn;
@@ -39,7 +30,13 @@
 import org.jboss.cache.notifications.annotation.CacheListener;
 import org.jboss.cache.notifications.annotation.NodeModified;
 import org.jboss.cache.notifications.event.NodeEvent;
+import static org.testng.AssertJUnit.*;
+import org.testng.annotations.Test;
 
+import javax.transaction.Synchronization;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+
 /**
  * Tests the ability to force a state transfer in the presence of
  * transactional and non-transactional threads that are hung holding
@@ -48,6 +45,7 @@
  * @author Brian Stansberry
  * @version $Revision$
  */
+ at Test(groups = {"functional"})
 public class ForcedStateTransferTest extends StateTransferTestBase
 {
    /**
@@ -94,7 +92,7 @@
     */
    static abstract class TaskRunner extends Thread
    {
-      CacheSPI<Object, Object>  cache;
+      CacheSPI<Object, Object> cache;
       Fqn fqn;
       String value;
       Exception failure;
@@ -402,8 +400,8 @@
     * @throws Exception
     */
    private CacheSPI<Object, Object> initializeSender(String isolationLevel,
-                                     boolean replSync,
-                                     boolean useMarshalling) throws Exception
+                                                     boolean replSync,
+                                                     boolean useMarshalling) throws Exception
    {
       CacheSPI<Object, Object> sender = createCache("sender", isolationLevel, replSync, useMarshalling, true);
 
@@ -750,8 +748,8 @@
     * @throws Exception
     */
    private CacheSPI<Object, Object> startReceiver(String isolationLevel,
-                                  boolean replSync,
-                                  boolean useMarshalling) throws Exception
+                                                  boolean replSync,
+                                                  boolean useMarshalling) throws Exception
    {
       CacheSPI<Object, Object> receiver = createCache("receiver", isolationLevel, replSync, useMarshalling, false);
 
@@ -777,11 +775,11 @@
     * Override the superclass version to set an unlimited state transfer timeout
     * and a 1 sec lock acquisition timeout.
     */
-   private CacheSPI<Object, Object>  createCache(String cacheID,
-                                String isolationLevel,
-                                boolean replSync,
-                                boolean useMarshalling,
-                                boolean startCache)
+   private CacheSPI<Object, Object> createCache(String cacheID,
+                                                String isolationLevel,
+                                                boolean replSync,
+                                                boolean useMarshalling,
+                                                boolean startCache)
            throws Exception
    {
       CacheSPI<Object, Object> result = super.createCache(cacheID, replSync,

Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransfer200Test.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransfer200Test.java	2007-10-01 09:24:57 UTC (rev 4520)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransfer200Test.java	2007-10-01 12:25:58 UTC (rev 4521)
@@ -7,16 +7,6 @@
 
 package org.jboss.cache.statetransfer;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.fail;
-
-import java.lang.reflect.Method;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
 import org.jboss.cache.CacheImpl;
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.Fqn;
@@ -26,15 +16,22 @@
 import org.jboss.cache.factories.XmlConfigurationParser;
 import org.jboss.cache.loader.CacheLoader;
 import org.jboss.cache.misc.TestingUtil;
+import static org.testng.AssertJUnit.*;
+import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import java.lang.reflect.Method;
+
 /**
  * Tests that state transfer works properly if the version is 2.0.0.GA.
  *
  * @author <a href="mailto://brian.stansberry@jboss.com">Brian Stansberry</a>
  * @version $Revision$
  */
+ at Test(groups = {"functional"})
 public class StateTransfer200Test extends StateTransferTestBase
 {
 
@@ -57,7 +54,7 @@
       cache1.put(backup, "name", JOE);
       cache1.put(A_B, "age", TWENTY);
 
-      CacheSPI<Object, Object>  cache2 = createCache("cache2", false, false, false);
+      CacheSPI<Object, Object> cache2 = createCache("cache2", false, false, false);
 
       // Pause to give caches time to see each other
       TestingUtil.blockUntilViewsReceived(new CacheSPI[]{cache1, cache2}, 60000);
@@ -79,7 +76,7 @@
       cache1.put(A_C, "name", JANE);
 
       // now start up cache 2
-      CacheSPI<Object, Object>  cache2 = createCache("cache2", false, false, false, false, false);
+      CacheSPI<Object, Object> cache2 = createCache("cache2", false, false, false, false, false);
       cache2.getConfiguration().setBuddyReplicationConfig(getBuddyConfig());
       cache2.start();
 
@@ -100,7 +97,7 @@
    @SuppressWarnings("null")
    public void testCacheLoaderFailure() throws Exception
    {
-      CacheSPI<Object, Object>  cache1 = createCache("cache1", false, false, "org.jboss.cache.statetransfer.CorruptedFileCacheLoader", false, true);
+      CacheSPI<Object, Object> cache1 = createCache("cache1", false, false, "org.jboss.cache.statetransfer.CorruptedFileCacheLoader", false, true);
 
       cache1.put(A_B, "name", JOE);
       cache1.put(A_B, "age", TWENTY);
@@ -125,7 +122,7 @@
 
    public void testLoadEntireStateAfterStart() throws Exception
    {
-      CacheSPI<Object, Object>  cache1 = createCache("cache1", false, true, true);
+      CacheSPI<Object, Object> cache1 = createCache("cache1", false, true, true);
 
       createAndActivateRegion(cache1, Fqn.ROOT);
 
@@ -134,7 +131,7 @@
       cache1.put(A_C, "name", BOB);
       cache1.put(A_C, "age", FORTY);
 
-      CacheSPI<Object, Object>  cache2 = createCache("cache2", false, true, true);
+      CacheSPI<Object, Object> cache2 = createCache("cache2", false, true, true);
 
       // Pause to give caches time to see each other
       TestingUtil.blockUntilViewsReceived(new CacheSPI[]{cache1, cache2}, 60000);
@@ -171,7 +168,7 @@
       cache1.put(A_C, "name", BOB);
       cache1.put(A_C, "age", FORTY);
 
-      CacheSPI<Object, Object>  cache2 = createCache("cache2", false, false, false);
+      CacheSPI<Object, Object> cache2 = createCache("cache2", false, false, false);
 
       // Pause to give caches time to see each other
       TestingUtil.blockUntilViewsReceived(new CacheSPI[]{cache1, cache2}, 60000);
@@ -200,7 +197,7 @@
 
    public void testPartialStateTransfer() throws Exception
    {
-      CacheSPI<Object, Object>  cache1 = createCache("cache1", false, true, false);
+      CacheSPI<Object, Object> cache1 = createCache("cache1", false, true, false);
 
       createAndActivateRegion(cache1, A);
 
@@ -209,7 +206,7 @@
       cache1.put(A_C, "name", BOB);
       cache1.put(A_C, "age", FORTY);
 
-      CacheSPI<Object, Object>  cache2 = createCache("cache2", false, true, false);
+      CacheSPI<Object, Object> cache2 = createCache("cache2", false, true, false);
 
       // Pause to give caches time to see each other
       TestingUtil.blockUntilViewsReceived(new CacheSPI[]{cache1, cache2}, 60000);
@@ -262,7 +259,7 @@
 
    public void testPartialStateTferWithLoader() throws Exception
    {
-      CacheSPI<Object, Object>  cache1 = createCache("cache1", false, true, true);
+      CacheSPI<Object, Object> cache1 = createCache("cache1", false, true, true);
 
       createAndActivateRegion(cache1, A);
 
@@ -271,7 +268,7 @@
       cache1.put(A_C, "name", BOB);
       cache1.put(A_C, "age", FORTY);
 
-      CacheSPI<Object, Object>  cache2 = createCache("cache2", false, true, true);
+      CacheSPI<Object, Object> cache2 = createCache("cache2", false, true, true);
 
       // Pause to give caches time to see each other
       TestingUtil.blockUntilViewsReceived(new CacheSPI[]{cache1, cache2}, 60000);
@@ -359,7 +356,7 @@
       // Set the TCL to a classloader that can't see Person/Address
       Thread.currentThread().setContextClassLoader(getNotFoundClassLoader());
 
-      CacheSPI<Object, Object>  cache1 = createCache("cache1",
+      CacheSPI<Object, Object> cache1 = createCache("cache1",
               false, // async
               true, // use marshaller
               true, // use cacheloader
@@ -375,7 +372,7 @@
       cache1.put(A_B, "person", ben);
 
       // For cache 2 we won't register loader until later
-      CacheSPI<Object, Object>  cache2 = createCache("cache2",
+      CacheSPI<Object, Object> cache2 = createCache("cache2",
               false, // async
               true, // use marshalling
               true, // use cacheloader

Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferCompatibilityTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferCompatibilityTest.java	2007-10-01 09:24:57 UTC (rev 4520)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferCompatibilityTest.java	2007-10-01 12:25:58 UTC (rev 4521)
@@ -1,5 +1,8 @@
 package org.jboss.cache.statetransfer;
 
+import org.testng.annotations.Test;
+
+ at Test(groups = {"functional"})
 public class StateTransferCompatibilityTest extends StateTransferTestBase
 {
 
@@ -7,8 +10,8 @@
    {
       return "2.0.0.GA";
    }
-   
 
+
    /**
     * These tests ensure that http://jira.jboss.com/jira/browse/JBCACHE-738
     * compatibility between non-delegating cacheloaders is maintained. In the tests

Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferConcurrencyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferConcurrencyTest.java	2007-10-01 09:24:57 UTC (rev 4520)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferConcurrencyTest.java	2007-10-01 12:25:58 UTC (rev 4521)
@@ -7,16 +7,6 @@
 
 package org.jboss.cache.statetransfer;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.AssertJUnit.fail;
-
-import java.util.Random;
-import java.util.Set;
-import java.util.concurrent.Semaphore;
-import java.util.concurrent.TimeUnit;
-
 import org.jboss.cache.Cache;
 import org.jboss.cache.CacheException;
 import org.jboss.cache.CacheSPI;
@@ -29,6 +19,14 @@
 import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
 import org.jboss.cache.marshall.InactiveRegionException;
 import org.jboss.cache.misc.TestingUtil;
+import static org.testng.AssertJUnit.*;
+import org.testng.annotations.Test;
+
+import java.util.Random;
+import java.util.Set;
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.TimeUnit;
+
 /**
  * Abstract superclass of "StateTransferVersion"-specific tests
  * of CacheSPI's state transfer capability.
@@ -38,6 +36,7 @@
  * @author <a href="mailto://brian.stansberry@jboss.com">Brian Stansberry</a>
  * @version $Id$
  */
+ at Test(groups = {"functional"})
 public class StateTransferConcurrencyTest extends StateTransferTestBase
 {
 
@@ -377,16 +376,16 @@
          for (int x = 0; x < 1; x++)
          {
 
-		    // Reset things by inactivating the region
-		    // and enabling the stressors
-		    for (int i = 0; i < count; i++)
-		    {
-			   Region r = cacheA.getRegion(Fqn.fromString("/" + names[i]), true);
-			   r.registerContextClassLoader(getClass().getClassLoader());
-			   r.deactivate();
-			   System.out.println("Run " + x + "-- /" + names[i] + " deactivated on A");
-		       stressors[i].startPuts();
-		    }
+            // Reset things by inactivating the region
+            // and enabling the stressors
+            for (int i = 0; i < count; i++)
+            {
+               Region r = cacheA.getRegion(Fqn.fromString("/" + names[i]), true);
+               r.registerContextClassLoader(getClass().getClassLoader());
+               r.deactivate();
+               System.out.println("Run " + x + "-- /" + names[i] + " deactivated on A");
+               stressors[i].startPuts();
+            }
 
             // Release the semaphore to allow the threads to start work
             semaphore.release(count);
@@ -396,7 +395,7 @@
             TestingUtil.sleepThread((long) 1000);
 
             // Activate cacheA
-            for (CacheStressor stressor:stressors)
+            for (CacheStressor stressor : stressors)
             {
                System.out.println("Activating /" + stressor.getName() + " on A");
                cacheA.getRegion(Fqn.fromString("/" + stressor.getName()), true).activate();
@@ -661,7 +660,7 @@
          TestingUtil.sleepRandom(5000);
          createAndActivateRegion(cache, A_B);
          System.out.println(name + " activated region" + " " + System.currentTimeMillis());
-         Fqn<String> childFqn = new Fqn<String>(A_B,name);
+         Fqn<String> childFqn = new Fqn<String>(A_B, name);
 
          cache.put(childFqn, "KEY", "VALUE");
          //         System.out.println(name + " put fqn " + childFqn + " " + System.currentTimeMillis());

Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferTestBase.java	2007-10-01 09:24:57 UTC (rev 4520)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferTestBase.java	2007-10-01 12:25:58 UTC (rev 4521)
@@ -22,16 +22,6 @@
 
 package org.jboss.cache.statetransfer;
 
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-import java.util.concurrent.Semaphore;
-import java.util.concurrent.TimeUnit;
-
 import org.jboss.cache.Cache;
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
@@ -44,15 +34,26 @@
 import org.jboss.cache.loader.CacheLoader;
 import org.jboss.cache.marshall.SelectedClassnameClassLoader;
 import org.jboss.cache.misc.TestingUtil;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertFalse;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
 
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.TimeUnit;
+
 /**
  * Abstract superclass of the StateTransfer tests.
  *
  * @author <a href="mailto://brian.stansberry@jboss.com">Brian Stansberry</a>
  * @version $Revision$
  */
+ at Test(groups = {"functional"})
 public abstract class StateTransferTestBase extends AbstractCacheLoaderTestBase
 {
    protected static final int SUBTREE_SIZE = 10;
@@ -81,21 +82,21 @@
    protected abstract String getReplicationVersion();
 
    protected CacheSPI<Object, Object> createCache(String cacheID,
-                                  boolean sync,
-                                  boolean useMarshalling,
-                                  boolean useCacheLoader)
-         throws Exception
+                                                  boolean sync,
+                                                  boolean useMarshalling,
+                                                  boolean useCacheLoader)
+           throws Exception
    {
       return createCache(cacheID, sync, useMarshalling, useCacheLoader, false, true);
    }
 
    protected CacheSPI<Object, Object> createCache(String cacheID,
-                                  boolean sync,
-                                  boolean useMarshalling,
-                                  boolean useCacheLoader,
-                                  boolean cacheLoaderAsync,
-                                  boolean startCache)
-         throws Exception
+                                                  boolean sync,
+                                                  boolean useMarshalling,
+                                                  boolean useCacheLoader,
+                                                  boolean cacheLoaderAsync,
+                                                  boolean startCache)
+           throws Exception
    {
       if (useCacheLoader)
       {
@@ -108,7 +109,7 @@
    }
 
    protected CacheSPI<Object, Object> createCache(String cacheID, boolean sync, boolean useMarshalling, String cacheLoaderClass,
-                                  boolean cacheLoaderAsync, boolean startCache) throws Exception
+                                                  boolean cacheLoaderAsync, boolean startCache) throws Exception
    {
       if (caches.get(cacheID) != null)
       {
@@ -199,7 +200,7 @@
                                        String cacheID,
                                        boolean useExtended,
                                        boolean async)
-         throws Exception
+           throws Exception
    {
       configureCacheLoader(c, "org.jboss.cache.loader.FileCacheLoader", cacheID, useExtended, async);
    }
@@ -221,14 +222,14 @@
                System.out.println("Error loading jdbc properties ");
             }
             String props = "cache.jdbc.driver =" + prop.getProperty("cache.jdbc.driver") + "\n" + "cache.jdbc.url="
-                           + prop.getProperty("cache.jdbc.url") + "\n" + "cache.jdbc.user="
-                           + prop.getProperty("cache.jdbc.user") + "\n" + "cache.jdbc.password="
-                           + prop.getProperty("cache.jdbc.password") + "\n" + "cache.jdbc.node.type="
-                           + prop.getProperty("cache.jdbc.node.type") + "\n" + "cache.jdbc.sql-concat="
-                           + prop.getProperty("cache.jdbc.sql-concat");
+                    + prop.getProperty("cache.jdbc.url") + "\n" + "cache.jdbc.user="
+                    + prop.getProperty("cache.jdbc.user") + "\n" + "cache.jdbc.password="
+                    + prop.getProperty("cache.jdbc.password") + "\n" + "cache.jdbc.node.type="
+                    + prop.getProperty("cache.jdbc.node.type") + "\n" + "cache.jdbc.sql-concat="
+                    + prop.getProperty("cache.jdbc.sql-concat");
 
             c.setCacheLoaderConfig(getSingleCacheLoaderConfig("", "org.jboss.cache.loader.JDBCCacheLoader",
-                                                              props, false, true, false));
+                    props, false, true, false));
          }
          else
          {
@@ -385,7 +386,7 @@
    protected ClassLoader getClassLoader() throws Exception
    {
       String[] includesClasses = {"org.jboss.cache.marshall.Person",
-                                  "org.jboss.cache.marshall.Address"};
+              "org.jboss.cache.marshall.Address"};
       String[] excludesClasses = {};
       ClassLoader cl = Thread.currentThread().getContextClassLoader();
       return new SelectedClassnameClassLoader(includesClasses, excludesClasses, cl);
@@ -394,7 +395,7 @@
    protected ClassLoader getNotFoundClassLoader() throws Exception
    {
       String[] notFoundClasses = {"org.jboss.cache.marshall.Person",
-                                  "org.jboss.cache.marshall.Address"};
+              "org.jboss.cache.marshall.Address"};
       ClassLoader cl = Thread.currentThread().getContextClassLoader();
       return new SelectedClassnameClassLoader(null, null, notFoundClasses, cl);
    }
@@ -415,7 +416,7 @@
                 String name,
                 boolean sync,
                 boolean activateRoot)
-            throws Exception
+              throws Exception
       {
          this.cache = createCache(name, sync, true, false);
          this.semaphore = semaphore;




More information about the jbosscache-commits mailing list