[jbosscache-commits] JBoss Cache SVN: r4458 - in core/trunk/src: main/java/org/jboss/cache/interceptors and 12 other directories.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Thu Sep 13 01:47:29 EDT 2007


Author: genman
Date: 2007-09-13 01:47:28 -0400 (Thu, 13 Sep 2007)
New Revision: 4458

Added:
   core/trunk/src/test/java/org/jboss/cache/options/TestVersion.java
Removed:
   core/trunk/src/main/java/org/jboss/cache/MyClass.java
Modified:
   core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/UnlockInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java
   core/trunk/src/main/java/org/jboss/cache/loader/ChainingCacheLoader.java
   core/trunk/src/main/java/org/jboss/cache/loader/JDBCCacheLoader.java
   core/trunk/src/main/java/org/jboss/cache/loader/TcpDelegatingCacheLoader.java
   core/trunk/src/test/java/org/jboss/cache/GlobalTransactionTest.java
   core/trunk/src/test/java/org/jboss/cache/api/SyncReplTest.java
   core/trunk/src/test/java/org/jboss/cache/api/SyncReplTxTest.java
   core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderTestsBase.java
   core/trunk/src/test/java/org/jboss/cache/marshall/LocalTest.java
   core/trunk/src/test/java/org/jboss/cache/marshall/RedeploymentEmulationTest.java
   core/trunk/src/test/java/org/jboss/cache/marshall/data/Debug.java
   core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsTest.java
   core/trunk/src/test/java/org/jboss/cache/passivation/PassivationTestsBase.java
   core/trunk/src/test/java/org/jboss/cache/replicated/SyncReplTest.java
   core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransfer200Test.java
   core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferUnderLoadTest.java
   core/trunk/src/test/java/org/jboss/cache/transaction/TransactionTest.java
Log:
Clean up some additional warnings about null/non-null values; deprecation
Move TestVersion class to separate file

Deleted: core/trunk/src/main/java/org/jboss/cache/MyClass.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/MyClass.java	2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/main/java/org/jboss/cache/MyClass.java	2007-09-13 05:47:28 UTC (rev 4458)
@@ -1,60 +0,0 @@
-package org.jboss.cache;
-
-import org.jboss.kernel.plugins.bootstrap.standalone.StandaloneBootstrap;
-
-/**
- * // TODO: Add Javadocs
- *
- * @author <a href="mailto:manik at jboss.org">Manik Surtani</a>
- * @since 2.0.0
- */
-public class MyClass
-{
-   private int x, y;
-
-
-   public MyClass()
-   {
-	// some dummy dependency
-	//
-	
-	org.jgroups.Address addr = new org.jgroups.stack.IpAddress();
-   }
-
-   public MyClass(int x, int y)
-   {
-      this.x = x;
-      this.y = y;
-   }
-
-
-   public int getX()
-   {
-      return x;
-   }
-
-   public void setX(int x)
-   {
-      this.x = x;
-   }
-
-   public int getY()
-   {
-      return y;
-   }
-
-   public void setY(int y)
-   {
-      this.y = y;
-   }
-
-   public int add()
-   {
-      return x + y;
-   }
-
-   public int multiply()
-   {
-      return x * y;
-   }
-}

Modified: core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java	2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java	2007-09-13 05:47:28 UTC (rev 4458)
@@ -35,6 +35,7 @@
 
    // for now, we delegate RPC calls to deprecated methods in CacheImpl.
 
+   @SuppressWarnings("deprecation")
    public List callRemoteMethods(List<Address> recipients, MethodCall methodCall, int mode, boolean excludeSelf, long timeout) throws Exception
    {
       return c.callRemoteMethods(recipients, methodCall, mode, excludeSelf, timeout);
@@ -50,11 +51,13 @@
       return c.getCoordinator();
    }
 
+   @SuppressWarnings("deprecation")
    public List callRemoteMethods(List<Address> recipients, MethodCall methodCall, boolean synchronous, boolean excludeSelf, int timeout) throws Exception
    {
       return c.callRemoteMethods(recipients, methodCall, synchronous, excludeSelf, timeout);
    }
 
+   @SuppressWarnings("deprecation")
    public List callRemoteMethods(List<Address> recipients, Method method, Object[] arguments, boolean synchronous, boolean excludeSelf, long timeout) throws Exception
    {
       return c.callRemoteMethods(recipients, method, arguments, synchronous, excludeSelf, timeout);

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java	2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java	2007-09-13 05:47:28 UTC (rev 4458)
@@ -251,27 +251,6 @@
       }
    }
 
-   private List getFqnsFromModificationList(List<MethodCall> modifications)
-   {
-      List<Fqn> fqnList = new ArrayList<Fqn>();
-
-      for (MethodCall mc : modifications)
-      {
-         Fqn fqn = findFqn(mc.getArgs());
-         if (fqn != null && !fqnList.contains(fqn)) fqnList.add(fqn);
-      }
-      return fqnList;
-   }
-
-   private Fqn findFqn(Object[] args)
-   {
-      for (Object arg : args)
-      {
-         if (arg instanceof Fqn) return (Fqn) arg;
-      }
-      return null;
-   }
-
    public long getCacheLoaderStores()
    {
       return m_cacheStores;

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java	2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java	2007-09-13 05:47:28 UTC (rev 4458)
@@ -176,11 +176,7 @@
 
          if (fqn != null && !EvictionInterceptor.this.canIgnoreEvent(fqn, NodeEventType.VISIT_NODE_EVENT))
          {
-            if (fqn != null
-                    && !EvictionInterceptor.this.canIgnoreEvent(fqn, NodeEventType.VISIT_NODE_EVENT))
-            {
-               return new EvictedEventNode(fqn, NodeEventType.VISIT_NODE_EVENT);
-            }
+            return new EvictedEventNode(fqn, NodeEventType.VISIT_NODE_EVENT);
          }
 
          return null;

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java	2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java	2007-09-13 05:47:28 UTC (rev 4458)
@@ -137,9 +137,6 @@
             log.debug("Found root node in workspace.");
          }
 
-         // we will always have one root node here, by this stage
-         Fqn currentFqn = Fqn.ROOT;
-
          // iterate through the target Fqn's elements.
          int targetFqnSize = targetFqn.size(), currentDepth = 1;
          for (Object childName : targetFqn.peekElements())

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/UnlockInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/UnlockInterceptor.java	2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/UnlockInterceptor.java	2007-09-13 05:47:28 UTC (rev 4458)
@@ -1,15 +1,15 @@
 package org.jboss.cache.interceptors;
 
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+
+import javax.transaction.Transaction;
+
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.InvocationContext;
 import org.jboss.cache.lock.IdentityLock;
-import org.jboss.cache.marshall.MethodCall;
 
-import javax.transaction.Transaction;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-
 /**
  * When a call returns, unlocks all locks held by the current thread in the
  * LockTable. This is a no-op if a transaction is used.

Modified: core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java	2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java	2007-09-13 05:47:28 UTC (rev 4458)
@@ -807,7 +807,7 @@
       this.config = (cache == null ? null : cache.getConfiguration());
       synchronized (listenerCount)
       {
-         if (listenerCount.get() > 0)
+         if (listenerCount.get() > 0 && cache != null)
          {
             cache.addCacheListener(cacheNotificationListener);
          }

Modified: core/trunk/src/main/java/org/jboss/cache/loader/ChainingCacheLoader.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/ChainingCacheLoader.java	2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/main/java/org/jboss/cache/loader/ChainingCacheLoader.java	2007-09-13 05:47:28 UTC (rev 4458)
@@ -274,6 +274,7 @@
       {
          CacheLoader cl = it.next();
          CacheLoaderConfig.IndividualCacheLoaderConfig cfg = cfgIt.next();
+         cl.setConfig(cfg);
          cl.create();
       }
    }

Modified: core/trunk/src/main/java/org/jboss/cache/loader/JDBCCacheLoader.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/JDBCCacheLoader.java	2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/main/java/org/jboss/cache/loader/JDBCCacheLoader.java	2007-09-13 05:47:28 UTC (rev 4458)
@@ -1,15 +1,6 @@
 package org.jboss.cache.loader;
 
-import net.jcip.annotations.ThreadSafe;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.config.CacheLoaderConfig;
-import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
-import org.jboss.cache.marshall.NodeData;
-
 import java.io.InputStream;
-import java.io.ObjectInputStream;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
@@ -18,6 +9,15 @@
 import java.util.List;
 import java.util.Map;
 
+import net.jcip.annotations.ThreadSafe;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.config.CacheLoaderConfig;
+import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
+import org.jboss.cache.marshall.NodeData;
+
 /**
  * JDBC implementation of <tt>AdjListJDBCCacheLoader</tt>.
  * Represents a faster alternative than JDBCCacheLoaderOld and relies on the same database structrure.
@@ -157,7 +157,6 @@
       InputStream is = rs.getBinaryStream(index);
       if (is != null && !rs.wasNull())
       {
-         ObjectInputStream ois;
          try
          {
             Object marshalledNode = unmarshall(is);

Modified: core/trunk/src/main/java/org/jboss/cache/loader/TcpDelegatingCacheLoader.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/TcpDelegatingCacheLoader.java	2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/main/java/org/jboss/cache/loader/TcpDelegatingCacheLoader.java	2007-09-13 05:47:28 UTC (rev 4458)
@@ -228,14 +228,11 @@
          out.reset();
 
          out.writeByte(TcpCacheOperations.PUT_LIST);
-         int length = modifications != null ? modifications.size() : 0;
+         int length = modifications.size();
          out.writeInt(length);
-         if (length > 0)
+         for (Modification m : modifications) 
          {
-            for (Modification m : modifications)
-            {
-               m.writeExternal(out);
-            }
+            m.writeExternal(out);
          }
          out.flush();
          Object retval = in.readObject();

Modified: core/trunk/src/test/java/org/jboss/cache/GlobalTransactionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/GlobalTransactionTest.java	2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/test/java/org/jboss/cache/GlobalTransactionTest.java	2007-09-13 05:47:28 UTC (rev 4458)
@@ -10,11 +10,9 @@
 import static org.testng.AssertJUnit.assertFalse;
 import static org.testng.AssertJUnit.assertNotNull;
 import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.AssertJUnit.fail;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
-import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.net.UnknownHostException;
@@ -46,8 +44,8 @@
       assertTrue(tx1.equals(tx2));
 
    }
+   
    @Test(groups = {"functional"})
-
    public void testEqualityWithOtherObject() throws UnknownHostException
    {
       IpAddress a1 = new IpAddress("localhost", 4444);
@@ -90,7 +88,7 @@
    }
 
    @Test(groups = {"functional"})
-   public void testExternalization() throws UnknownHostException
+   public void testExternalization() throws Exception
    {
       IpAddress a1 = new IpAddress("localhost", 4444);
       IpAddress a2 = new IpAddress("localhost", 5555);
@@ -104,39 +102,20 @@
       tx1 = GlobalTransaction.create(a1);
       tx2 = GlobalTransaction.create(a2);
 
-      try
-      {
-         bos = new ByteArrayOutputStream(1024);
-         out = new ObjectOutputStream(bos);
-         out.writeObject(tx1);
-         out.writeObject(tx2);
-         out.flush();
-         buf = bos.toByteArray();
-      }
-      catch (IOException ex)
-      {
-         fail("creation of output stream");
-      }
+      bos = new ByteArrayOutputStream(1024);
+      out = new ObjectOutputStream(bos);
+      out.writeObject(tx1);
+      out.writeObject(tx2);
+      out.flush();
+      buf = bos.toByteArray();
 
-      try
-      {
-         bis = new ByteArrayInputStream(buf);
-         in = new ObjectInputStream(bis);
-         tx1_copy = (GlobalTransaction) in.readObject();
-         tx2_copy = (GlobalTransaction) in.readObject();
-      }
-      catch (IOException ex)
-      {
-         fail("creation of input stream");
-      }
-      catch (ClassNotFoundException e)
-      {
-         e.printStackTrace();
-         fail();
-      }
+      bis = new ByteArrayInputStream(buf);
+      in = new ObjectInputStream(bis);
+      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);
+            "\ntx2: " + tx2 + ", tx2_copy: " + tx2_copy);
 
       assertNotNull(tx1_copy);
       assertNotNull(tx2_copy);

Modified: core/trunk/src/test/java/org/jboss/cache/api/SyncReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/SyncReplTest.java	2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/test/java/org/jboss/cache/api/SyncReplTest.java	2007-09-13 05:47:28 UTC (rev 4458)
@@ -10,7 +10,6 @@
 import static org.testng.AssertJUnit.assertEquals;
 import static org.testng.AssertJUnit.assertNotNull;
 import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.fail;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -140,13 +139,12 @@
    {
       InvocationContext ctx = c.getInvocationContext();
       InvocationContext control = null;
-      try
-      {
+      try {
          control = ctx.clone();
       }
       catch (CloneNotSupportedException e)
       {
-         fail("Unable to clone InvocationContext");
+         throw new RuntimeException(e);
       }
 
       control.reset();

Modified: core/trunk/src/test/java/org/jboss/cache/api/SyncReplTxTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/SyncReplTxTest.java	2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/test/java/org/jboss/cache/api/SyncReplTxTest.java	2007-09-13 05:47:28 UTC (rev 4458)
@@ -10,7 +10,6 @@
 import static org.testng.AssertJUnit.assertEquals;
 import static org.testng.AssertJUnit.assertNotNull;
 import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.fail;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -158,7 +157,7 @@
       }
       catch (CloneNotSupportedException e)
       {
-         fail("Unable to clone InvocationCOntext");
+         throw new RuntimeException(e);
       }
 
       control.reset();

Modified: core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderTestsBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderTestsBase.java	2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderTestsBase.java	2007-09-13 05:47:28 UTC (rev 4458)
@@ -412,29 +412,14 @@
 
 
    @SuppressWarnings("unchecked")
-   public void testCacheLoading2() throws CacheException
+   public void testCacheLoading2() throws Exception
    {
       Set keys = null;
       cache.put("/a/b/c", "key", "val");
-      try
-      {
-         keys = cache.getKeys("/a/b/c");
-         assertNotNull(keys);
-         assertEquals(1, keys.size());
-      }
-      catch (Exception e)
-      {
-         fail(e.toString());
-      }
-
-      try
-      {
-         keys.add("myKey");
-      }
-      catch (UnsupportedOperationException ex)
-      {
-         fail("unsupported operation: " + ex);
-      }
+      keys = cache.getKeys("/a/b/c");
+      assertNotNull(keys);
+      assertEquals(1, keys.size());
+      keys.add("myKey");
    }
 
 
@@ -1847,12 +1832,10 @@
 
       // Save state
       byte[] state;
-      ByteArrayOutputStream baos = null;
-      MarshalledValueOutputStream os = null;
+      ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
+      MarshalledValueOutputStream os = new MarshalledValueOutputStream(baos);
       try
       {
-         baos = new ByteArrayOutputStream(1024);
-         os = new MarshalledValueOutputStream(baos);
          loader.loadEntireState(os);
       }
       catch (UnsupportedOperationException ex)
@@ -1868,11 +1851,10 @@
       }
 
       /* Restore state. */
-      MarshalledValueInputStream is = null;
+      ByteArrayInputStream bais = new ByteArrayInputStream(state);
+      MarshalledValueInputStream is = new MarshalledValueInputStream(bais);
       try
       {
-         ByteArrayInputStream bais = new ByteArrayInputStream(state);
-         is = new MarshalledValueInputStream(bais);
          loader.storeEntireState(is);
       }
       catch (UnsupportedOperationException ex)

Modified: core/trunk/src/test/java/org/jboss/cache/marshall/LocalTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/LocalTest.java	2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/LocalTest.java	2007-09-13 05:47:28 UTC (rev 4458)
@@ -62,6 +62,7 @@
       }
    }
 
+   @SuppressWarnings("deprecation")
    public void testClassloader() throws Exception
    {
       String jarDir = System.getProperty("test.jar.dir");

Modified: core/trunk/src/test/java/org/jboss/cache/marshall/RedeploymentEmulationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/RedeploymentEmulationTest.java	2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/RedeploymentEmulationTest.java	2007-09-13 05:47:28 UTC (rev 4458)
@@ -123,6 +123,7 @@
       region.unregisterContextClassLoader();
    }
 
+   @SuppressWarnings("deprecation")
    private URLClassLoader createOrphanClassLoader() throws MalformedURLException
    {
       File f;

Modified: core/trunk/src/test/java/org/jboss/cache/marshall/data/Debug.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/data/Debug.java	2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/data/Debug.java	2007-09-13 05:47:28 UTC (rev 4458)
@@ -24,6 +24,7 @@
       displayClassInfo(clazz, results, true);
    }
 
+   @SuppressWarnings("null")
    public static void displayClassInfo(Class clazz, StringBuffer results,
                                        boolean showParentClassLoaders)
    {
@@ -44,10 +45,7 @@
          {
             break;
          }
-         if (parent != null)
-         {
-            parent = parent.getParent();
-         }
+         parent = parent.getParent();
       }
       CodeSource clazzCS = clazz.getProtectionDomain().getCodeSource();
       if (clazzCS != null)

Modified: core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsTest.java	2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsTest.java	2007-09-13 05:47:28 UTC (rev 4458)
@@ -205,58 +205,4 @@
       assertEquals(vChild, ((NodeSPI)cache.get("/parent/child")).getVersion());
    }
 
-}
-
-/**
- * Note that this uses STRING comparisons!!
- */
-class TestVersion implements DataVersion
-{
-   private static final long serialVersionUID = -5577530957664493161L;
-   private String myVersion;
-
-   public TestVersion(String version)
-   {
-      myVersion = version;
-   }
-
-   public String getInternalVersion()
-   {
-      return myVersion;
-   }
-
-   public void setInternalVersion(String version)
-   {
-      myVersion = version;
-   }
-
-   public boolean newerThan(DataVersion other)
-   {
-      if (other instanceof TestVersion)
-      {
-         return myVersion.compareTo(((TestVersion)other).getInternalVersion()) > 0;
-      }
-      else
-      {
-         throw new IllegalArgumentException("version type mismatch");
-      }
-   }
-
-   public String toString()
-   {
-      return "TestVersion-" + myVersion;
-   }
-
-   public boolean equals(Object other)
-   {
-      if (other instanceof TestVersion)
-      {
-         TestVersion oVersion = (TestVersion)other;
-         if (oVersion.myVersion == null && myVersion == null)
-            return true;
-         if (myVersion != null)
-            return myVersion.equals(oVersion.myVersion);
-      }
-      return false;
-   }
 }
\ No newline at end of file

Added: core/trunk/src/test/java/org/jboss/cache/options/TestVersion.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/TestVersion.java	                        (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/options/TestVersion.java	2007-09-13 05:47:28 UTC (rev 4458)
@@ -0,0 +1,58 @@
+package org.jboss.cache.options;
+
+import org.jboss.cache.optimistic.DataVersion;
+
+/**
+ * Note that this uses STRING comparisons!!
+ */
+public class TestVersion implements DataVersion
+{
+   
+   private static final long serialVersionUID = -5577530957664493161L;
+   
+   private String myVersion;
+
+   public TestVersion(String version)
+   {
+      myVersion = version;
+   }
+
+   public String getInternalVersion()
+   {
+      return myVersion;
+   }
+
+   public void setInternalVersion(String version)
+   {
+      myVersion = version;
+   }
+
+   public boolean newerThan(DataVersion other)
+   {
+      if (other instanceof TestVersion)
+      {
+         return myVersion.compareTo(((TestVersion) other).getInternalVersion()) > 0;
+      }
+      else
+      {
+         throw new IllegalArgumentException("version type mismatch");
+      }
+   }
+
+
+   public String toString()
+   {
+      return "TestVersion-" + myVersion;
+   }
+
+   public boolean equals(Object other)
+   {
+      if (other instanceof TestVersion)
+      {
+         TestVersion oVersion = (TestVersion) other;
+         if (oVersion.myVersion == null && myVersion == null) return true;
+         if (myVersion != null) return myVersion.equals(oVersion.myVersion);
+      }
+      return false;
+   }
+}
\ No newline at end of file

Modified: core/trunk/src/test/java/org/jboss/cache/passivation/PassivationTestsBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/passivation/PassivationTestsBase.java	2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/PassivationTestsBase.java	2007-09-13 05:47:28 UTC (rev 4458)
@@ -289,29 +289,14 @@
    }
 
 
-   public void testCacheLoading2() throws CacheException
+   public void testCacheLoading2() throws Exception
    {
       Set<Object> keys = null;
       cache.put("/a/b/c", "key", "val");
-      try
-      {
-         keys = cache.getKeys(Fqn.fromString("/a/b/c"));
-         assertNotNull(keys);
-         assertEquals(1, keys.size());
-      }
-      catch (Exception e)
-      {
-         fail(e.toString());
-      }
-
-      try
-      {
-         keys.add("myKey");
-      }
-      catch (UnsupportedOperationException ex)
-      {
-         fail("unsupported operation: " + ex);
-      }
+      keys = cache.getKeys(Fqn.fromString("/a/b/c"));
+      assertNotNull(keys);
+      assertEquals(1, keys.size());
+      keys.add("myKey");
    }
 
 

Modified: core/trunk/src/test/java/org/jboss/cache/replicated/SyncReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/replicated/SyncReplTest.java	2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/test/java/org/jboss/cache/replicated/SyncReplTest.java	2007-09-13 05:47:28 UTC (rev 4458)
@@ -9,7 +9,6 @@
 import static org.testng.AssertJUnit.assertEquals;
 import static org.testng.AssertJUnit.assertNotNull;
 import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.fail;
 
 import org.jboss.cache.Cache;
 import org.jboss.cache.DefaultCacheFactory;
@@ -53,7 +52,6 @@
          for (Cache c : caches)
          {
             c.stop();
-            c = null;
          }
          caches = null;
       }
@@ -129,7 +127,7 @@
       }
       catch (CloneNotSupportedException e)
       {
-         fail("Unable to clone InvocationCOntext");
+         throw new RuntimeException(e);
       }
 
       control.reset();

Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransfer200Test.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransfer200Test.java	2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransfer200Test.java	2007-09-13 05:47:28 UTC (rev 4458)
@@ -9,7 +9,6 @@
 
 import static org.testng.AssertJUnit.assertEquals;
 import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNotNull;
 import static org.testng.AssertJUnit.assertNull;
 import static org.testng.AssertJUnit.fail;
 
@@ -98,6 +97,7 @@
       assertEquals("/a/c state should have integrated in backup region " + test, JANE, cache2.get(test, "name"));
    }
 
+   @SuppressWarnings("null")
    public void testCacheLoaderFailure() throws Exception
    {
       CacheSPI<Object, Object>  cache1 = createCache("cache1", false, false, "org.jboss.cache.statetransfer.CorruptedFileCacheLoader", false, true);
@@ -117,7 +117,6 @@
       }
       catch (Exception e)
       {
-         assertNotNull(e);
       }
 
       //when persistent transfer fails as in this case state recipient cacheloader should be wiped clean

Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferUnderLoadTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferUnderLoadTest.java	2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferUnderLoadTest.java	2007-09-13 05:47:28 UTC (rev 4458)
@@ -126,10 +126,7 @@
       }
       finally
       {
-         if (writer != null)
-         {
-            writer.stop();
-         }
+        writer.stop();
       }
    }
 

Modified: core/trunk/src/test/java/org/jboss/cache/transaction/TransactionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/TransactionTest.java	2007-09-12 05:07:16 UTC (rev 4457)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/TransactionTest.java	2007-09-13 05:47:28 UTC (rev 4458)
@@ -584,15 +584,14 @@
       cache.remove("/a/b/c");
       // this node should now be locked.
       Transaction t = cache.getTransactionManager().suspend();
-      Transaction t2 = null;
+      Transaction t2;
+      System.out.println(cache.printLockInfo());
+      // start a new tx
+      cache.getTransactionManager().begin();
+      t2 = cache.getTransactionManager().getTransaction();
       try
       {
-         System.out.println(cache.printLockInfo());
-         // start a new tx
-         cache.getTransactionManager().begin();
-         t2 = cache.getTransactionManager().getTransaction();
          cache.get("/a/b/c");// should fail
-         t2.commit();
          fail("Should not be able to get a hold of /a/b/c until the deleting tx completes");
       }
       catch (Exception e)




More information about the jbosscache-commits mailing list