[jboss-cvs] JBossCache/src/org/jboss/cache/interceptors ...

Manik Surtani msurtani at belmont.prod.atl2.jboss.com
Wed Aug 30 17:05:16 EDT 2006


  User: msurtani
  Date: 06/08/30 17:05:16

  Modified:    src/org/jboss/cache/interceptors 
                        OptimisticValidatorInterceptor.java
  Log:
  fixed up some unit tests
  
  Revision  Changes    Path
  1.33      +196 -193  JBossCache/src/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: OptimisticValidatorInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -b -r1.32 -r1.33
  --- OptimisticValidatorInterceptor.java	25 Aug 2006 14:10:07 -0000	1.32
  +++ OptimisticValidatorInterceptor.java	30 Aug 2006 21:05:16 -0000	1.33
  @@ -18,7 +18,6 @@
   import org.jboss.cache.optimistic.DefaultDataVersion;
   import org.jboss.cache.optimistic.TransactionWorkspace;
   import org.jboss.cache.optimistic.WorkspaceNode;
  -import org.jboss.cache.marshall.MethodCall;
   
   import javax.transaction.Transaction;
   import java.util.Collection;
  @@ -105,9 +104,9 @@
           WorkspaceNode workspaceNode;
   
           boolean trace = log.isTraceEnabled();
  -        for (Iterator it = nodes.iterator(); it.hasNext();)
  +      for (Object node : nodes)
           {
  -            workspaceNode = (WorkspaceNode) it.next();
  +         workspaceNode = (WorkspaceNode) node;
               Fqn fqn = workspaceNode.getFqn();
               if (trace) log.trace("validating version for node " + fqn);
   
  @@ -128,10 +127,10 @@
               {
                   throw new CacheException("Real node for " + fqn + " is null, and this wasn't newly created in this tx!");
               }
  -            if (!workspaceNode.isCreated() && realNode.getVersion().newerThan( workspaceNode.getVersion() ))
  +         if (!workspaceNode.isCreated() && realNode.getVersion().newerThan(workspaceNode.getVersion()))
               {
                   // we have an out of date node here
  -                throw new CacheException("DataNode [" + fqn + "] version " + ((OptimisticTreeNode)workspaceNode.getNode()).getVersion() + " is newer than workspace node " + workspaceNode.getVersion());
  +            throw new CacheException("DataNode [" + fqn + "] version " + ((OptimisticTreeNode) workspaceNode.getNode()).getVersion() + " is newer than workspace node " + workspaceNode.getVersion());
               }
           }
       }
  @@ -174,7 +173,7 @@
                   {
                       cache.getNotifier().notifyNodeRemoved(dNode.getFqn(), true, dNode.getData() == null ? Collections.emptyMap() : Collections.unmodifiableMap(dNode.getData()));
                       DataNode parent = (DataNode) dNode.getParent();
  -                    parent.removeChild( dNode.getName() );
  +               parent.removeChild(dNode.getName());
                       cache.getNotifier().notifyNodeRemoved(dNode.getFqn(), false, null);
                   }
               }
  @@ -197,25 +196,29 @@
                       Map mergedData = wrappedNode.getMergedData();
                       boolean needsNotify = !dataEquals(mergedData, current.getData());
   
  -                    if (needsNotify) cache.getNotifier().notifyNodeModified(wrappedNode.getFqn(), true, current.getData() == null ? Collections.emptyMap() : Collections.unmodifiableMap(current.getData()));
  +               if (needsNotify)
  +                  cache.getNotifier().notifyNodeModified(wrappedNode.getFqn(), true, current.getData() == null ? Collections.emptyMap() : Collections.unmodifiableMap(current.getData()));
   
                       current.put(mergedData, true);
                       if (workspace.isVersioningImplicit())
                       {
  -                        current.setVersion(((DefaultDataVersion)wrappedNode.getVersion()).increment());
  +                  current.setVersion(((DefaultDataVersion) wrappedNode.getVersion()).increment());
                       }
                       else
                       {
                           if (trace) log.trace("Versioning is explicit; not attempting an increment.");
                           current.setVersion(wrappedNode.getVersion());
                       }
  -                    if (trace) log.trace("Setting version of node " + current.getName() + " from " + wrappedNode.getVersion() + " to " + current.getVersion());
  +               if (trace)
  +                  log.trace("Setting version of node " + current.getName() + " from " + wrappedNode.getVersion() + " to " + current.getVersion());
   
  -                    if (needsNotify) cache.getNotifier().notifyNodeModified(wrappedNode.getFqn(), false, mergedData == null ? Collections.emptyMap()  : Collections.unmodifiableMap(mergedData));
  +               if (needsNotify)
  +                  cache.getNotifier().notifyNodeModified(wrappedNode.getFqn(), false, mergedData == null ? Collections.emptyMap() : Collections.unmodifiableMap(mergedData));
                   }
                   else
                   {
  -                    if (trace) log.trace("Merging node " + wrappedNode.getFqn() + " not necessary since the node is not dirty");
  +               if (trace)
  +                  log.trace("Merging node " + wrappedNode.getFqn() + " not necessary since the node is not dirty");
                       cache.getNotifier().notifyNodeVisited(wrappedNode.getFqn(), true);
                       cache.getNotifier().notifyNodeVisited(wrappedNode.getFqn(), false);
                   }
  
  
  



More information about the jboss-cvs-commits mailing list