[jbosscache-commits] JBoss Cache SVN: r5529 - in core/trunk/src: main/java/org/jboss/cache/loader/bdbje and 18 other directories.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Thu Apr 10 19:33:57 EDT 2008


Author: manik.surtani at jboss.com
Date: 2008-04-10 19:33:56 -0400 (Thu, 10 Apr 2008)
New Revision: 5529

Modified:
   core/trunk/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/loader/bdbje/BdbjeCacheLoader.java
   core/trunk/src/main/java/org/jboss/cache/loader/jdbm/JdbmCacheLoader.java
   core/trunk/src/main/java/org/jboss/cache/loader/s3/S3CacheLoader.java
   core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java
   core/trunk/src/test/java/org/jboss/cache/FqnTest.java
   core/trunk/src/test/java/org/jboss/cache/api/NodeAPITest.java
   core/trunk/src/test/java/org/jboss/cache/api/NodeReplicatedMoveTest.java
   core/trunk/src/test/java/org/jboss/cache/api/NodeSPITest.java
   core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyAssignmentStateTransferTest.java
   core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyBackupActivationInactivationTest.java
   core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyGroupAssignmentTest.java
   core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyManagerTest.java
   core/trunk/src/test/java/org/jboss/cache/buddyreplication/RemoveRootBuddyTest.java
   core/trunk/src/test/java/org/jboss/cache/demo/JBossCacheGUI.java
   core/trunk/src/test/java/org/jboss/cache/eviction/LRUPolicyTest.java
   core/trunk/src/test/java/org/jboss/cache/eviction/OptimisticEvictionTest.java
   core/trunk/src/test/java/org/jboss/cache/eviction/ProgrammaticLRUPolicyTest.java
   core/trunk/src/test/java/org/jboss/cache/integration/hibernate/HibernateIntegrationTestUtil.java
   core/trunk/src/test/java/org/jboss/cache/interceptors/EvictionInterceptorTest.java
   core/trunk/src/test/java/org/jboss/cache/invalidation/InvalidationInterceptorTest.java
   core/trunk/src/test/java/org/jboss/cache/loader/BdbjeTest.java
   core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderConnectionTest.java
   core/trunk/src/test/java/org/jboss/cache/loader/TcpCacheServerTest.java
   core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshallerTestBase.java
   core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/ComparatorTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/ConcurrentTransactionTest.java
   core/trunk/src/test/java/org/jboss/cache/passivation/ConcurrentPassivationTest.java
   core/trunk/src/test/java/org/jboss/cache/passivation/PassivationActivationCallbacksTestCase.java
   core/trunk/src/test/java/org/jboss/cache/passivation/PassivationTestsBase.java
   core/trunk/src/test/java/org/jboss/cache/statetransfer/ForcedStateTransferTest.java
   core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferConcurrencyTest.java
   core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedNodeCreationRollbackTest.java
Log:
Updated code that uses deprecated Fqn constructors

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java	2008-04-10 23:12:19 UTC (rev 5528)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java	2008-04-10 23:33:56 UTC (rev 5529)
@@ -1,5 +1,6 @@
 package org.jboss.cache.interceptors;
 
+import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.InvocationContext;
 import org.jboss.cache.Modification;
@@ -9,8 +10,8 @@
 import org.jboss.cache.commands.cachedata.PutDataMapCommand;
 import org.jboss.cache.commands.cachedata.PutKeyValueCommand;
 import org.jboss.cache.commands.cachedata.RemoveDataCommand;
+import org.jboss.cache.commands.cachedata.RemoveKeyCommand;
 import org.jboss.cache.commands.cachedata.RemoveNodeCommand;
-import org.jboss.cache.commands.cachedata.RemoveKeyCommand;
 import org.jboss.cache.commands.tx.CommitCommand;
 import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
 import org.jboss.cache.commands.tx.PrepareCommand;
@@ -25,7 +26,6 @@
 import org.jboss.cache.transaction.GlobalTransaction;
 import org.jboss.cache.transaction.TransactionEntry;
 import org.jboss.cache.transaction.TransactionTable;
-import org.apache.commons.logging.LogFactory;
 
 import javax.transaction.SystemException;
 import javax.transaction.TransactionManager;
@@ -327,7 +327,7 @@
       {
          for (Object child : childrenNames)
          {
-            recursiveMove(new Fqn(fqn, child), new Fqn(newFqn, child));
+            recursiveMove(Fqn.fromRelativeElements(fqn, child), Fqn.fromRelativeElements(newFqn, child));
          }
       }
    }

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java	2008-04-10 23:12:19 UTC (rev 5528)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java	2008-04-10 23:33:56 UTC (rev 5529)
@@ -6,12 +6,18 @@
  */
 package org.jboss.cache.interceptors;
 
-import org.jboss.cache.*;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.cache.CacheException;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.InvocationContext;
+import org.jboss.cache.NodeFactory;
+import org.jboss.cache.NodeNotExistsException;
+import org.jboss.cache.NodeSPI;
 import org.jboss.cache.commands.TxCacheCommand;
 import org.jboss.cache.commands.cachedata.*;
 import org.jboss.cache.commands.remote.DataGravitationCleanupCommand;
+import org.jboss.cache.config.Configuration;
 import org.jboss.cache.config.Option;
-import org.jboss.cache.config.Configuration;
 import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.invocation.CacheData;
 import org.jboss.cache.loader.CacheLoaderManager;
@@ -22,7 +28,6 @@
 import org.jboss.cache.optimistic.TransactionWorkspace;
 import org.jboss.cache.optimistic.WorkspaceNode;
 import org.jboss.cache.transaction.GlobalTransaction;
-import org.apache.commons.logging.LogFactory;
 
 import java.util.Collections;
 import java.util.HashMap;
@@ -100,7 +105,8 @@
       if (workspaceNode != null)
       {
          setVersioning(ctx, workspace, workspaceNode);
-      } else
+      }
+      else
       {
          // "fail-more-silently" patch thanks to Owen Taylor - JBCACHE-767
          if ((ctx.getOptionOverrides() == null || !ctx.getOptionOverrides().isFailSilently()))
@@ -121,7 +127,8 @@
       if (workspaceNode != null)
       {
          setVersioning(ctx, workspace, workspaceNode);
-      } else
+      }
+      else
       {
          // "fail-more-silently" patch thanks to Owen Taylor - JBCACHE-767
          if ((ctx.getOptionOverrides() == null || !ctx.getOptionOverrides().isFailSilently()))
@@ -192,7 +199,8 @@
       {
          if (trace) log.debug("Unable to find node " + command.getFqn() + " in workspace.");
          result = null;
-      } else
+      }
+      else
       {
          //add this node into the wrokspace
          notifier.notifyNodeVisited(command.getFqn(), true, ctx);
@@ -214,7 +222,8 @@
       {
          if (trace) log.trace("unable to find node " + fqn + " in workspace.");
          result = null;
-      } else
+      }
+      else
       {
          notifier.notifyNodeVisited(fqn, true, ctx);
          Object keySet = workspaceNode.getKeys();
@@ -234,7 +243,8 @@
       {
          if (trace) log.trace("unable to find node " + command.getFqn() + " in workspace.");
          result = null;
-      } else
+      }
+      else
       {
          notifier.notifyNodeVisited(command.getFqn(), true, ctx);
          Object data = workspaceNode.getData();
@@ -254,7 +264,8 @@
       {
          if (trace) log.trace("Unable to find node " + command.getFqn() + " in workspace.");
          result = null;
-      } else
+      }
+      else
       {
          notifier.notifyNodeVisited(command.getFqn(), true, ctx);
          Object nameSet = workspaceNode.getChildrenNames();
@@ -274,11 +285,13 @@
       {
          if (trace) log.trace("Unable to find node " + command.getFqn() + " in workspace.");
          result = null;
-      } else if (workspaceNode.isDeleted())
+      }
+      else if (workspaceNode.isDeleted())
       {
          if (trace) log.trace("Attempted to retrieve node " + command.getFqn() + " but it has been deleted!");
          result = null;
-      } else
+      }
+      else
       {
          notifier.notifyNodeVisited(command.getFqn(), true, ctx);
          workspace.addNode(workspaceNode);
@@ -300,7 +313,8 @@
          if (trace) log.trace("Setting versioning for node " + workspaceNode.getFqn() + " to explicit");
 
          workspaceNode.setVersioningImplicit(false);
-      } else
+      }
+      else
       {
          if (trace) log.trace("Setting versioning for node " + workspaceNode.getFqn() + " to implicit");
          workspaceNode.setVersioningImplicit(true);
@@ -375,11 +389,11 @@
 
       // now that we have the parent and target nodes:
       // first correct the pointers at the pruning point
-      oldParent.removeChild(new Fqn(nodeName));
+      oldParent.removeChild(nodeName);
 
       // parent pointer is calculated on the fly using Fqns.
       // now adjust Fqns of node and all children.
-      Fqn nodeNewFqn = new Fqn(parent.getFqn(), nodeFqn.getLastElement());
+      Fqn nodeNewFqn = Fqn.fromRelativeElements(parent.getFqn(), nodeFqn.getLastElement());
 
       // pre-notify
       notifier.notifyNodeMoved(nodeFqn, nodeNewFqn, true, ctx);
@@ -401,14 +415,14 @@
     */
    private void recursiveMoveNode(InvocationContext ctx, WorkspaceNode node, Fqn newBase, TransactionWorkspace ws)
    {
-      Fqn newFqn = new Fqn(newBase, node.getFqn().getLastElement());
+      Fqn newFqn = Fqn.fromRelativeElements(newBase, node.getFqn().getLastElement());
       WorkspaceNode movedNode = fetchWorkspaceNode(ctx, newFqn, ws, true, true);
       movedNode.putAll(node.getData());
 
       // invoke children
       for (Object n : node.getChildrenNames())
       {
-         WorkspaceNode child = fetchWorkspaceNode(ctx, new Fqn(node.getFqn(), n), ws, false, true);
+         WorkspaceNode child = fetchWorkspaceNode(ctx, Fqn.fromRelativeElements(node.getFqn(), n), ws, false, true);
          if (child != null) recursiveMoveNode(ctx, child, newFqn, ws);
       }
    }
@@ -467,7 +481,8 @@
          {
             if (trace) log.trace("marking node " + toDelete.getFqn() + " as deleted");
             toDelete.markAsDeleted(true);
-         } else
+         }
+         else
          {
             break;// no more children, we came to the end
          }
@@ -553,7 +568,8 @@
          if (undeleteIfNecessary)
          {
             undeleteWorkspaceNode(workspaceNode, fetchWorkspaceNode(ctx, fqn.getParent(), workspace, true, includeInvalidNodes));
-         } else
+         }
+         else
          {
             // don't return deleted nodes if undeleteIfNecessary is false!
             workspaceNode = null;

Modified: core/trunk/src/main/java/org/jboss/cache/loader/bdbje/BdbjeCacheLoader.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/bdbje/BdbjeCacheLoader.java	2008-04-10 23:12:19 UTC (rev 5528)
+++ core/trunk/src/main/java/org/jboss/cache/loader/bdbje/BdbjeCacheLoader.java	2008-04-10 23:33:56 UTC (rev 5529)
@@ -700,7 +700,7 @@
          {
             for (String child : children)
             {
-               doRemove(txn, new Fqn(child));
+               doRemove(txn, Fqn.fromElements(child));
             }
          }
       }
@@ -1020,7 +1020,7 @@
       while (tupleInput.available() > 0)
       {
          String part = tupleInput.readString();
-         name = new Fqn(name, part);
+         name = Fqn.fromRelativeElements(name, part);
       }
       return name;
    }

Modified: core/trunk/src/main/java/org/jboss/cache/loader/jdbm/JdbmCacheLoader.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/jdbm/JdbmCacheLoader.java	2008-04-10 23:12:19 UTC (rev 5528)
+++ core/trunk/src/main/java/org/jboss/cache/loader/jdbm/JdbmCacheLoader.java	2008-04-10 23:33:56 UTC (rev 5529)
@@ -239,7 +239,7 @@
     */
    private Fqn keys(Fqn name)
    {
-      return new Fqn(name, KEYS);
+      return Fqn.fromRelativeElements(name, KEYS);
    }
 
    /**
@@ -247,7 +247,7 @@
     */
    private Fqn key(Fqn name, Object key)
    {
-      return new Fqn(name, KEYS, nullMask(key));
+      return Fqn.fromRelativeElements(name, KEYS, nullMask(key));
    }
 
    /**
@@ -663,7 +663,7 @@
       BTree bt = tree;
       int size = (bt == null) ? -1 : bt.size();
       return "JdbmCacheLoader locationStr=" + config.getLocation() +
-             " size=" + size;
+            " size=" + size;
    }
 
 }

Modified: core/trunk/src/main/java/org/jboss/cache/loader/s3/S3CacheLoader.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/s3/S3CacheLoader.java	2008-04-10 23:12:19 UTC (rev 5528)
+++ core/trunk/src/main/java/org/jboss/cache/loader/s3/S3CacheLoader.java	2008-04-10 23:33:56 UTC (rev 5529)
@@ -1,13 +1,5 @@
 package org.jboss.cache.loader.s3;
 
-import java.io.BufferedInputStream;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
 import net.jcip.annotations.ThreadSafe;
 import net.noderunner.amazon.s3.Bucket;
 import net.noderunner.amazon.s3.Connection;
@@ -16,14 +8,21 @@
 import net.noderunner.amazon.s3.ListResponse;
 import net.noderunner.amazon.s3.Response;
 import net.noderunner.amazon.s3.S3Object;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
 import org.jboss.cache.loader.AbstractCacheLoader;
 
+import java.io.BufferedInputStream;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
+
 /**
  * Uses the Amazon S3 service for storage.
  * See http://aws.amazon.com/ for information.
@@ -53,7 +52,6 @@
  * parent nodes, this can potentially need to inconsistencies. To disable caching,
  * set {@link S3LoaderConfig#setParentCache} to false.
  * <p/>
- * 
  *
  * @author Elias Ross
  * @version $Id: JdbmCacheLoader.java 4298 2007-08-15 18:30:00Z genman $
@@ -83,7 +81,7 @@
     * Zero depth prefix.
     */
    private final char DEPTH_0 = 'A';
-   
+
    /**
     * Stateless connection; thread safe.
     */
@@ -93,6 +91,7 @@
     * Map classes to characters.
     */
    private static Map<Class<?>, Character> prefix = new HashMap<Class<?>, Character>();
+
    static
    {
       prefix.put(Byte.class, 'B');
@@ -435,7 +434,7 @@
          log.trace("remove children: " + children);
          for (String child : children)
          {
-            remove(new Fqn(name, child));
+            remove(Fqn.fromRelativeElements(name, child));
          }
       }
       Response response = connection.delete(getBucket(), key(name));

Modified: core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java	2008-04-10 23:12:19 UTC (rev 5528)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java	2008-04-10 23:33:56 UTC (rev 5529)
@@ -17,7 +17,11 @@
 import org.jgroups.Address;
 import org.jgroups.stack.IpAddress;
 
-import java.io.*;
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
 import java.util.*;
 
 /**
@@ -65,7 +69,6 @@
 
    protected CommandMarshaller commandMarshaller;
 
-
    // -------- AbstractMarshaller interface
 
    public void objectToObjectStream(Object o, ObjectOutputStream out) throws Exception
@@ -683,7 +686,7 @@
          {
             elements.add(unmarshallObject(in, refMap));
          }
-         fqn = new Fqn(elements, true);
+         fqn = Fqn.fromList(elements);
       }
       else
       {

Modified: core/trunk/src/test/java/org/jboss/cache/FqnTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/FqnTest.java	2008-04-10 23:12:19 UTC (rev 5528)
+++ core/trunk/src/test/java/org/jboss/cache/FqnTest.java	2008-04-10 23:33:56 UTC (rev 5529)
@@ -44,7 +44,7 @@
 
    public void testNull()
    {
-      Fqn fqn = new Fqn();
+      Fqn fqn = Fqn.ROOT;
       log("null fqn is " + fqn);
       assert 0 == fqn.size();
       int hcode = fqn.hashCode();
@@ -53,7 +53,7 @@
 
    public void testOne()
    {
-      Fqn<Integer> fqn = new Fqn<Integer>(22);
+      Fqn<Integer> fqn = Fqn.fromElements(22);
       log("one fqn is " + fqn);
       assert 1 == fqn.size();
       int hcode = fqn.hashCode();
@@ -62,8 +62,8 @@
 
    public void testEmptyFqn()
    {
-      Fqn f1 = new Fqn();
-      Fqn f2 = new Fqn();
+      Fqn f1 = Fqn.ROOT;
+      Fqn f2 = Fqn.ROOT;
       assert f1.equals(f2);
    }
 
@@ -73,7 +73,7 @@
       log("fqn is " + fqn);
       assert 3 == fqn.size();
 
-      Fqn<String> fqn2 = new Fqn<String>("a", "b", "c");
+      Fqn<String> fqn2 = Fqn.fromElements("a", "b", "c");
       log("fqn2 is " + fqn2);
       assert 3 == fqn.size();
       assert fqn.equals(fqn2);
@@ -82,11 +82,11 @@
 
    public void testHereogeneousNames()
    {
-      Fqn<Object> fqn = new Fqn<Object>("string", 38, true);
+      Fqn fqn = Fqn.fromElements("string", 38, true);
       log("fqn is " + fqn);
       assert 3 == fqn.size();
 
-      Fqn<Object> fqn2 = new Fqn<Object>("string", 38, true);
+      Fqn fqn2 = Fqn.fromElements("string", 38, true);
       assert fqn.equals(fqn2);
       assert fqn.hashCode() == fqn2.hashCode();
    }
@@ -94,7 +94,7 @@
    public void testHashcode()
    {
       Fqn fqn1, fqn2;
-      fqn1 = new Fqn<Object>("a", "b", "c");
+      fqn1 = Fqn.fromElements("a", "b", "c");
       fqn2 = Fqn.fromString("/a/b/c");
       log("fqn is " + fqn1);
       assert fqn1.equals(fqn2);
@@ -108,7 +108,7 @@
 
    public void testHashcode2()
    {
-      Fqn<Integer> fqn = new Fqn<Integer>(-1);
+      Fqn<Integer> fqn = Fqn.fromElements(-1);
       log("one fqn is " + fqn);
       assert fqn.size() == 1;
       int hcode = fqn.hashCode();
@@ -117,24 +117,22 @@
 
    public void testEquals()
    {
-      Fqn<String> fqn1 = new Fqn<String>("person/test");
+      Fqn<String> fqn1 = Fqn.fromElements("person/test");
 
-      Fqn<String> f1;
-      Fqn<String> f2;
-      Fqn<String> f3;
+      Fqn f1, f2, f3;
 
-      f1 = new Fqn<String>(fqn1, "0");
-      f2 = new Fqn<String>(fqn1, "1");
-      f3 = new Fqn<String>(fqn1, "2");
+      f1 = Fqn.fromRelativeElements(fqn1, "0");
+      f2 = Fqn.fromRelativeElements(fqn1, "1");
+      f3 = Fqn.fromRelativeElements(fqn1, "2");
 
-      HashMap<Fqn<String>, String> map = new HashMap<Fqn<String>, String>();
+      HashMap<Fqn, String> map = new HashMap<Fqn, String>();
       map.put(f1, "0");
       map.put(f2, "1");
       map.put(f3, "2");
 
-      assert map.get(new Fqn<String>(fqn1, "0")) != null;
-      assert map.get(new Fqn<String>(fqn1, "1")) != null;
-      assert map.get(new Fqn<String>(fqn1, "2")) != null;
+      assert map.get(Fqn.fromRelativeElements(fqn1, "0")) != null;
+      assert map.get(Fqn.fromRelativeElements(fqn1, "1")) != null;
+      assert map.get(Fqn.fromRelativeElements(fqn1, "2")) != null;
 
    }
 
@@ -163,27 +161,27 @@
 
    public void testEquals3()
    {
-      Fqn<Object> f1;
+      Fqn f1;
       Fqn<?> f2;
-      f1 = new Fqn<Object>("a", 322649, Boolean.TRUE);
-      f2 = new Fqn<String>();
+      f1 = Fqn.fromElements("a", 322649, Boolean.TRUE);
+      f2 = Fqn.ROOT;
       assert !f1.equals(f2);
       assert !f2.equals(f1);
 
       f2 = Fqn.fromString("a/322649/TRUE");
       assert !f1.equals(f2);
 
-      f2 = new Fqn<Object>("a", 322649, Boolean.FALSE);
+      f2 = Fqn.fromElements("a", 322649, Boolean.FALSE);
       assert !f1.equals(f2);
 
-      f2 = new Fqn<Object>("a", 322649, Boolean.TRUE);
+      f2 = Fqn.fromElements("a", 322649, Boolean.TRUE);
       assert f1.equals(f2);
    }
 
    public void testEquals3WithMarshalling() throws Exception
    {
-      Fqn<Object> f1, f2;
-      f1 = new Fqn<Object>("a", 322649, Boolean.TRUE);
+      Fqn f1, f2;
+      f1 = Fqn.fromElements("a", 322649, Boolean.TRUE);
       f2 = marshalAndUnmarshal(f1);
       assert f1.equals(f2);
       assert f2.equals(f1);
@@ -192,11 +190,11 @@
       f3 = marshalAndUnmarshal(f3);
       assert !f1.equals(f3);
 
-      f2 = new Fqn<Object>("a", 322649, Boolean.FALSE);
+      f2 = Fqn.fromElements("a", 322649, Boolean.FALSE);
       f2 = marshalAndUnmarshal(f2);
       assert !f1.equals(f2);
 
-      f2 = new Fqn<Object>("a", 322649, Boolean.TRUE);
+      f2 = Fqn.fromElements("a", 322649, Boolean.TRUE);
       f2 = marshalAndUnmarshal(f2);
       assert f1.equals(f2);
    }
@@ -210,7 +208,6 @@
       assert !fqn.equals(null);
    }
 
-   @Test(groups = {"functional"})
    public void testClone() throws CloneNotSupportedException
    {
       Fqn<String> fqn1 = Fqn.fromString("/a/b/c");
@@ -221,13 +218,13 @@
 
    public void testNullElements() throws CloneNotSupportedException
    {
-      Fqn<Object> fqn0 = new Fqn<Object>((Object) null);
+      Fqn<Object> fqn0 = Fqn.fromElements((Object) null);
       assert 1 == fqn0.size();
 
-      Fqn<Object> fqn1 = new Fqn<Object>("NULL", null, 0);
+      Fqn fqn1 = Fqn.fromElements("NULL", null, 0);
       assert 3 == fqn1.size();
 
-      Fqn<Object> fqn2 = new Fqn<Object>("NULL", null, 0);
+      Fqn fqn2 = Fqn.fromElements("NULL", null, 0);
       assert fqn1.hashCode() == fqn2.hashCode();
       assert fqn1.equals(fqn2);
       assert fqn1.equals(fqn1.clone());
@@ -237,12 +234,12 @@
    {
       Fqn<String> fqn = Fqn.fromString("/a/b/c");
       assert 3 == fqn.size();
-      Fqn<Object> tmp_fqn = new Fqn<Object>();
+      Fqn<Object> tmp_fqn = Fqn.ROOT;
       assert 0 == tmp_fqn.size();
       for (int i = 0; i < fqn.size(); i++)
       {
          String s = fqn.get(i);
-         tmp_fqn = new Fqn<Object>(tmp_fqn, s);
+         tmp_fqn = Fqn.fromRelativeElements(tmp_fqn, s);
          assert tmp_fqn.size() == i + 1;
       }
       assert 3 == tmp_fqn.size();
@@ -270,7 +267,7 @@
 
    public void testParentage()
    {
-      Fqn<String> fqnRoot = new Fqn<String>();
+      Fqn<String> fqnRoot = Fqn.ROOT;
       Fqn<String> parent = fqnRoot.getParent();
       assert parent.equals(fqnRoot);
 
@@ -293,7 +290,7 @@
 
    public void testRoot()
    {
-      Fqn<String> fqn = new Fqn<String>();
+      Fqn<String> fqn = Fqn.ROOT;
       assert fqn.isRoot();
 
       fqn = Fqn.fromString("/one/two");
@@ -302,11 +299,11 @@
 
    public void testGetName()
    {
-      Fqn<Integer> integerFqn = new Fqn<Integer>(1);
+      Fqn<Integer> integerFqn = Fqn.fromElements(1);
       assert "1".equals(integerFqn.getLastElementAsString());
 
       Object object = new Object();
-      Fqn<Object> objectFqn = new Fqn<Object>(object);
+      Fqn<Object> objectFqn = Fqn.fromElements(object);
       assert object.toString().equals(objectFqn.getLastElementAsString());
    }
 
@@ -316,16 +313,15 @@
       assert f.equals(f.clone());
    }
 
-   @Test(groups = {"functional"})
    public void testCloningOtherTypes() throws CloneNotSupportedException
    {
-      Fqn<Object> f = new Fqn<Object>("blah", 10, Boolean.TRUE);
+      Fqn f = Fqn.fromElements("blah", 10, Boolean.TRUE);
       assert f.equals(f.clone());
    }
 
    public void testRemovalNonString() throws Exception
    {
-      Fqn<Object> f = new Fqn<Object>("test", 1);
+      Fqn f = Fqn.fromElements("test", 1);
 
       Configuration c = new Configuration();
       c.setCacheMode("LOCAL");
@@ -358,16 +354,16 @@
 
       assert f.equals(f2);
 
-      Fqn<Integer> f3 = new Fqn<Integer>(1, 2, 3, 5);
+      Fqn<Integer> f3 = Fqn.fromElements(1, 2, 3, 5);
 
-      Fqn<Integer> f4 = new Fqn<Integer>(1, 2, 3);
+      Fqn<Integer> f4 = Fqn.fromElements(1, 2, 3);
 
       assert f3.getParent().equals(f4);
    }
 
    public void testSize()
    {
-      Fqn f = new Fqn();
+      Fqn f = Fqn.ROOT;
       assert f.size() == 0;
       assert f.isRoot();
 
@@ -380,18 +376,35 @@
       assert !f.isRoot();
    }
 
+//   public void testIntermediateFqns()
+//   {
+//      Fqn lastCreated = Fqn.fromString("/a/b");
+//      Fqn target = Fqn.fromString("/a/b/c/d/e/f");
+//
+//      List<Fqn> intermediates = new ArrayList<Fqn>();
+//      intermediates.add(Fqn.fromString("/a/b/c"));
+//      intermediates.add(Fqn.fromString("/a/b/c/d"));
+//      intermediates.add(Fqn.fromString("/a/b/c/d/e"));
+//
+//      System.out.println("Expecting " + intermediates);
+//      System.out.println("Was: " + target.getIntermediateFqns(lastCreated));
+//
+//      assert target.getIntermediateFqns(lastCreated).equals(intermediates);
+//   }
+
+   //
    public void testGenerations()
    {
-      Fqn<Integer> f = new Fqn<Integer>(1, 2, 3, 4, 5, 6, 7);
+      Fqn<Integer> f = Fqn.fromElements(1, 2, 3, 4, 5, 6, 7);
 
       assert f.equals(f.getAncestor(f.size()));
       assert f.getParent().equals(f.getAncestor(f.size() - 1));
       assert Fqn.ROOT.equals(f.getAncestor(0));
-      assert new Fqn<Integer>(1).equals(f.getAncestor(1));
-      assert new Fqn<Integer>(1, 2).equals(f.getAncestor(2));
-      assert new Fqn<Integer>(1, 2, 3).equals(f.getAncestor(3));
-      assert new Fqn<Integer>(1, 2, 3, 4).equals(f.getAncestor(4));
-      assert new Fqn<Integer>(1, 2, 3, 4, 5).equals(f.getAncestor(5));
+      assert Fqn.fromElements(1).equals(f.getAncestor(1));
+      assert Fqn.fromElements(1, 2).equals(f.getAncestor(2));
+      assert Fqn.fromElements(1, 2, 3).equals(f.getAncestor(3));
+      assert Fqn.fromElements(1, 2, 3, 4).equals(f.getAncestor(4));
+      assert Fqn.fromElements(1, 2, 3, 4, 5).equals(f.getAncestor(5));
 
       try
       {

Modified: core/trunk/src/test/java/org/jboss/cache/api/NodeAPITest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/NodeAPITest.java	2008-04-10 23:12:19 UTC (rev 5528)
+++ core/trunk/src/test/java/org/jboss/cache/api/NodeAPITest.java	2008-04-10 23:33:56 UTC (rev 5529)
@@ -16,7 +16,11 @@
 import org.testng.annotations.Test;
 
 import javax.transaction.TransactionManager;
-import java.util.*;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 /**
  * Tests {@link org.jboss.cache.Node}-centric operations
@@ -229,8 +233,8 @@
 
    public void testGetChildrenUnderTx() throws Exception
    {
-      Fqn<String> A_B = new Fqn<String>(A, B);
-      Fqn<String> A_C = new Fqn<String>(A, C);
+      Fqn A_B = Fqn.fromRelativeFqn(A, B);
+      Fqn A_C = Fqn.fromRelativeFqn(A, C);
       tm.begin();
       cache.put(A_B, "1", "1");
       cache.put(A_C, "2", "2");
@@ -285,7 +289,7 @@
       assertEquals("value", rootNode.getChild(A).getChild(B).get("key"));
       assertEquals("value", rootNode.getChild(A).getChild(B).getChild(C).get("key"));
 
-      assertNull(rootNode.getChild(new Fqn<String>("nonexistent")));
+      assertNull(rootNode.getChild(Fqn.fromElements("nonexistent")));
    }
 
    public void testClearingData()

Modified: core/trunk/src/test/java/org/jboss/cache/api/NodeReplicatedMoveTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/NodeReplicatedMoveTest.java	2008-04-10 23:12:19 UTC (rev 5528)
+++ core/trunk/src/test/java/org/jboss/cache/api/NodeReplicatedMoveTest.java	2008-04-10 23:33:56 UTC (rev 5529)
@@ -110,7 +110,7 @@
       assertEquals(vB, cache1.getRoot().getChild(A).getChild(B).get(k));
 
       assertInvalidated(cache2, A, "Should be invalidated");
-      assertInvalidated(cache2, new Fqn(A, B.getLastElement()), "Should be invalidated");
+      assertInvalidated(cache2, Fqn.fromRelativeElements(A, B.getLastElement()), "Should be invalidated");
 
       // now move...
       cache1.move(nodeB.getFqn(), Fqn.ROOT);
@@ -138,7 +138,7 @@
 
    public void testReplTxCommit() throws Exception
    {
-      Fqn A_B = new Fqn<String>(A, B);
+      Fqn A_B = Fqn.fromRelativeFqn(A, B);
       nodeA = rootNode.addChild(A);
       nodeB = nodeA.addChild(B);
 

Modified: core/trunk/src/test/java/org/jboss/cache/api/NodeSPITest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/NodeSPITest.java	2008-04-10 23:12:19 UTC (rev 5528)
+++ core/trunk/src/test/java/org/jboss/cache/api/NodeSPITest.java	2008-04-10 23:33:56 UTC (rev 5529)
@@ -116,7 +116,7 @@
       // put some stuff in the root node
       String childName = "childName";
       String newChild = "newChild";
-      root.addChild(new Fqn<String>(childName));
+      root.addChild(Fqn.fromElements(childName));
       Set childrenDirect = root.getChildrenDirect();
 
       try
@@ -130,7 +130,7 @@
       }
 
       // now test defensive copy
-      root.addChild(new Fqn<String>(newChild));
+      root.addChild(Fqn.fromElements(newChild));
 
       assertTrue("root.addChild() should have succeeded", root.getChildrenNamesDirect().contains(newChild));
       assertTrue("getChildrenDirect() should have made a defensive copy of the data collection object", !childrenDirect.contains(newChild));

Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyAssignmentStateTransferTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyAssignmentStateTransferTest.java	2008-04-10 23:12:19 UTC (rev 5528)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyAssignmentStateTransferTest.java	2008-04-10 23:33:56 UTC (rev 5529)
@@ -119,13 +119,11 @@
       Fqn mainD = Fqn.fromString("/d/e/f");
       caches.get(0).put(mainD, "name", "Joe");
 
-      Fqn group = new Fqn(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN,
-            BuddyManager.getGroupNameFromAddress(caches.get(0).getLocalAddress()));
-      Fqn testA = new Fqn(group, mainA);
+      Fqn testA = BuddyFqnTransformer.getBackupFqn(caches.get(0).getLocalAddress(), mainA);
       assertEquals("/a replicated", "Joe", caches.get(1).get(testA, "name"));
       assertNull("No backup of /a", caches.get(2).get(testA, "name"));
 
-      Fqn testD = new Fqn(group, mainD);
+      Fqn testD = BuddyFqnTransformer.getBackupFqn(caches.get(0).getLocalAddress(), mainD);
       assertEquals("/d replicated", "Joe", caches.get(1).get(testD, "name"));
       assertNull("No backup of /d", caches.get(2).get(testD, "name"));
 

Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyBackupActivationInactivationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyBackupActivationInactivationTest.java	2008-04-10 23:12:19 UTC (rev 5528)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyBackupActivationInactivationTest.java	2008-04-10 23:33:56 UTC (rev 5529)
@@ -114,8 +114,8 @@
       regionA.registerContextClassLoader(getClass().getClassLoader());
       regionA.activate();
 
-      Fqn<String> fqn = new Fqn<String>(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, "test");
-      fqn = new Fqn<String>(fqn, A_B);
+      Fqn fqn = Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, "test");
+      fqn = Fqn.fromRelativeFqn(fqn, A_B);
       cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
       cache1.put(fqn, "name", JOE);
 

Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyGroupAssignmentTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyGroupAssignmentTest.java	2008-04-10 23:12:19 UTC (rev 5528)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyGroupAssignmentTest.java	2008-04-10 23:33:56 UTC (rev 5529)
@@ -140,11 +140,11 @@
       System.out.println("*** Testing cache 1:");
       assertIsBuddy(caches.get(1), caches.get(0), true);
 
-      assert caches.get(0).peek(new Fqn(BuddyManager.BUDDY_BACKUP_SUBTREE, BuddyManager.getGroupNameFromAddress(caches.get(0).getLocalAddress())), false) == null : "Should not have backup region for self";
-      assert caches.get(0).peek(new Fqn(BuddyManager.BUDDY_BACKUP_SUBTREE, BuddyManager.getGroupNameFromAddress(caches.get(1).getLocalAddress())), false) != null : "Should have backup region for buddy";
+      assert caches.get(0).peek(BuddyManager.getBackupRoot(caches.get(0).getLocalAddress()), false) == null : "Should not have backup region for self";
+      assert caches.get(0).peek(BuddyManager.getBackupRoot(caches.get(1).getLocalAddress()), false) != null : "Should have backup region for buddy";
 
-      assert caches.get(1).peek(new Fqn(BuddyManager.BUDDY_BACKUP_SUBTREE, BuddyManager.getGroupNameFromAddress(caches.get(0).getLocalAddress())), false) != null : "Should have backup region for buddy";
-      assert caches.get(1).peek(new Fqn(BuddyManager.BUDDY_BACKUP_SUBTREE, BuddyManager.getGroupNameFromAddress(caches.get(1).getLocalAddress())), false) == null : "Should not have backup region for self";
+      assert caches.get(1).peek(BuddyManager.getBackupRoot(caches.get(0).getLocalAddress()), false) != null : "Should have backup region for buddy";
+      assert caches.get(1).peek(BuddyManager.getBackupRoot(caches.get(1).getLocalAddress()), false) == null : "Should not have backup region for self";
 
       caches.add(createCache(1, null));
 
@@ -162,17 +162,17 @@
       System.out.println("1 Lock info: " + CachePrinter.printCacheLockingInfo(caches.get(1)));
       System.out.println("2 Lock info: " + CachePrinter.printCacheLockingInfo(caches.get(2)));
 
-      assert caches.get(0).peek(new Fqn(BuddyManager.BUDDY_BACKUP_SUBTREE, BuddyManager.getGroupNameFromAddress(caches.get(0).getLocalAddress())), false) == null : "Should not have backup region for self";
-      assert caches.get(0).peek(new Fqn(BuddyManager.BUDDY_BACKUP_SUBTREE, BuddyManager.getGroupNameFromAddress(caches.get(1).getLocalAddress())), false) == null : "Should have backup region for non-buddy";
-      assert caches.get(0).peek(new Fqn(BuddyManager.BUDDY_BACKUP_SUBTREE, BuddyManager.getGroupNameFromAddress(caches.get(2).getLocalAddress())), false) != null : "Should have backup region for buddy";
+      assert caches.get(0).peek(BuddyManager.getBackupRoot(caches.get(0).getLocalAddress()), false) == null : "Should not have backup region for self";
+      assert caches.get(0).peek(BuddyManager.getBackupRoot(caches.get(1).getLocalAddress()), false) == null : "Should have backup region for non-buddy";
+      assert caches.get(0).peek(BuddyManager.getBackupRoot(caches.get(2).getLocalAddress()), false) != null : "Should have backup region for buddy";
 
-      assert caches.get(1).peek(new Fqn(BuddyManager.BUDDY_BACKUP_SUBTREE, BuddyManager.getGroupNameFromAddress(caches.get(0).getLocalAddress())), false) != null : "Should have backup region for buddy";
-      assert caches.get(1).peek(new Fqn(BuddyManager.BUDDY_BACKUP_SUBTREE, BuddyManager.getGroupNameFromAddress(caches.get(1).getLocalAddress())), false) == null : "Should not have backup region for self";
-      assert caches.get(1).peek(new Fqn(BuddyManager.BUDDY_BACKUP_SUBTREE, BuddyManager.getGroupNameFromAddress(caches.get(2).getLocalAddress())), false) == null : "Should not have backup region for non-buddy";
+      assert caches.get(1).peek(BuddyManager.getBackupRoot(caches.get(0).getLocalAddress()), false) != null : "Should have backup region for buddy";
+      assert caches.get(1).peek(BuddyManager.getBackupRoot(caches.get(1).getLocalAddress()), false) == null : "Should not have backup region for self";
+      assert caches.get(1).peek(BuddyManager.getBackupRoot(caches.get(2).getLocalAddress()), false) == null : "Should not have backup region for non-buddy";
 
-      assert caches.get(2).peek(new Fqn(BuddyManager.BUDDY_BACKUP_SUBTREE, BuddyManager.getGroupNameFromAddress(caches.get(0).getLocalAddress())), false) == null : "Should not have backup region for non-buddy";
-      assert caches.get(2).peek(new Fqn(BuddyManager.BUDDY_BACKUP_SUBTREE, BuddyManager.getGroupNameFromAddress(caches.get(1).getLocalAddress())), false) != null : "Should have backup region for buddy";
-      assert caches.get(2).peek(new Fqn(BuddyManager.BUDDY_BACKUP_SUBTREE, BuddyManager.getGroupNameFromAddress(caches.get(2).getLocalAddress())), false) == null : "Should not have backup region for self";
+      assert caches.get(2).peek(BuddyManager.getBackupRoot(caches.get(0).getLocalAddress()), false) == null : "Should not have backup region for non-buddy";
+      assert caches.get(2).peek(BuddyManager.getBackupRoot(caches.get(1).getLocalAddress()), false) != null : "Should have backup region for buddy";
+      assert caches.get(2).peek(BuddyManager.getBackupRoot(caches.get(2).getLocalAddress()), false) == null : "Should not have backup region for self";
 
       // ensure no state transfer has happened!!
       assert caches.get(2).peek(Fqn.fromString("/cache0"), false) == null : "Unnecessary state should not have been transferred!";

Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyManagerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyManagerTest.java	2008-04-10 23:12:19 UTC (rev 5528)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyManagerTest.java	2008-04-10 23:33:56 UTC (rev 5529)
@@ -7,8 +7,8 @@
 package org.jboss.cache.buddyreplication;
 
 import org.jboss.cache.Fqn;
+import org.jboss.cache.commands.CacheCommand;
 import org.jboss.cache.commands.CommandsFactory;
-import org.jboss.cache.commands.CacheCommand;
 import org.jboss.cache.commands.cachedata.PutKeyValueCommand;
 import org.jboss.cache.commands.remote.ReplicateCommand;
 import org.jboss.cache.config.BuddyReplicationConfig;
@@ -31,6 +31,7 @@
 {
 
    CommandsFactory commandsFactory = new CommandsFactory();
+
    /**
     * Constructs a buddy manager using the default buddy locator but with some specific properties.
     *
@@ -202,7 +203,7 @@
 
    public void testGetActualFqn()
    {
-      Fqn<String> x = new Fqn<String>("x");
+      Fqn<String> x = Fqn.fromString("/x");
       Fqn backup = BuddyFqnTransformer.getBackupFqn("y", x);
       assertEquals(x, BuddyFqnTransformer.getActualFqn(backup));
    }

Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/RemoveRootBuddyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/RemoveRootBuddyTest.java	2008-04-10 23:12:19 UTC (rev 5528)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/RemoveRootBuddyTest.java	2008-04-10 23:33:56 UTC (rev 5529)
@@ -27,7 +27,7 @@
       {
          String key = String.valueOf(opCount);
          String value = String.valueOf(opCount);
-         Fqn f = new Fqn("test", key);
+         Fqn f = Fqn.fromElements("test", key);
          cache1.put(f, key, value);
       }
       cache1.removeNode(Fqn.ROOT);

Modified: core/trunk/src/test/java/org/jboss/cache/demo/JBossCacheGUI.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/demo/JBossCacheGUI.java	2008-04-10 23:12:19 UTC (rev 5528)
+++ core/trunk/src/test/java/org/jboss/cache/demo/JBossCacheGUI.java	2008-04-10 23:33:56 UTC (rev 5529)
@@ -569,7 +569,7 @@
    /**
     * Recursively adds GUI nodes starting from fqn
     */
-   private void addGuiNode(Fqn<String> fqn)
+   private void addGuiNode(Fqn fqn)
    {
       Set<Object> children;
 
@@ -584,7 +584,7 @@
       {
          for (Object child_name : children)
          {
-            addGuiNode(new Fqn<String>(fqn, (String) child_name));
+            addGuiNode(Fqn.fromRelativeElements(fqn, child_name));
          }
       }
    }
@@ -595,7 +595,7 @@
       Fqn<String> fqnToPath;
       if (path.length == 0) fqnToPath = Fqn.ROOT;
       List<String> elements = convertMyNodeArrayToStringArray(path);
-      fqnToPath = new Fqn<String>(elements);
+      fqnToPath = Fqn.fromList(elements);
       if (root.hasChild(fqnToPath))
       {
          return root.getChild(fqnToPath);

Modified: core/trunk/src/test/java/org/jboss/cache/eviction/LRUPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/LRUPolicyTest.java	2008-04-10 23:12:19 UTC (rev 5528)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/LRUPolicyTest.java	2008-04-10 23:33:56 UTC (rev 5529)
@@ -214,7 +214,7 @@
       // then the child, leaving behind an empty parent
       Fqn<String> parent = Fqn.fromString(rootStr + "parent");
       cache.put(parent, "key", "value");
-      cache.put(new Fqn<String>(parent, "child"), "key", "value");
+      cache.put(Fqn.fromRelativeElements(parent, "child"), "key", "value");
 
       // Give eviction time to run a few times, then confirm parent
       // is completely gone

Modified: core/trunk/src/test/java/org/jboss/cache/eviction/OptimisticEvictionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/OptimisticEvictionTest.java	2008-04-10 23:12:19 UTC (rev 5528)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/OptimisticEvictionTest.java	2008-04-10 23:33:56 UTC (rev 5529)
@@ -3,14 +3,14 @@
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
-import org.jboss.cache.xml.XmlHelper;
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.config.EvictionConfig;
 import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
 import org.jboss.cache.factories.XmlConfigurationParser;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.EvictionConfig;
 import org.jboss.cache.interceptors.EvictionInterceptor;
 import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.transaction.DummyTransactionManagerLookup;
+import org.jboss.cache.xml.XmlHelper;
 import static org.testng.AssertJUnit.assertFalse;
 import static org.testng.AssertJUnit.assertTrue;
 import org.testng.annotations.AfterMethod;
@@ -39,7 +39,7 @@
    //Initial number of nodes
    private static final int NUMBER_NODES = 256;
 
-   private Fqn<Object> region = new Fqn<Object>("testingRegion");
+   private Fqn region = Fqn.fromElements("testingRegion");
    private TransactionManager txManager;
    private CacheSPI<Object, Object> cache;
 
@@ -78,7 +78,7 @@
             "         </config>\n" +
             "      </attribute>";
       Element element = XmlHelper.stringToElement(xml);
-      return XmlConfigurationParser.parseEvictionConfig(element);      
+      return XmlConfigurationParser.parseEvictionConfig(element);
    }
 
    @AfterMethod(alwaysRun = true)
@@ -109,7 +109,7 @@
       //Initialize the cache via a map
       for (int i = 0; i < NUMBER_NODES; i++)
       {
-         cache.put(new Fqn<Object>(region, i), i, i);
+         cache.put(Fqn.fromRelativeElements(region, i), i, i);
       }
 
       for (int i = 0; i < NUMBER_OF_RUNS; i++)
@@ -158,7 +158,7 @@
       // then the child, leaving behind an empty parent
       Fqn<String> parent = Fqn.fromString(rootStr + "parent");
       cache.put(parent, "key", "value");
-      cache.put(new Fqn<String>(parent, "child"), "key", "value");
+      cache.put(Fqn.fromRelativeElements(parent, "child"), "key", "value");
 
       // Give eviction time to run a few times, then confirm parent
       // is completely gone

Modified: core/trunk/src/test/java/org/jboss/cache/eviction/ProgrammaticLRUPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/ProgrammaticLRUPolicyTest.java	2008-04-10 23:12:19 UTC (rev 5528)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/ProgrammaticLRUPolicyTest.java	2008-04-10 23:33:56 UTC (rev 5529)
@@ -23,12 +23,16 @@
 package org.jboss.cache.eviction;
 
 
-import org.jboss.cache.*;
+import org.jboss.cache.CacheFactory;
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.DefaultCacheFactory;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.RegionManager;
+import org.jboss.cache.config.Configuration;
 import org.jboss.cache.config.EvictionConfig;
 import org.jboss.cache.config.EvictionRegionConfig;
-import org.jboss.cache.config.Configuration;
+import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
 import org.jboss.cache.factories.XmlConfigurationParser;
-import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
 import org.jboss.cache.lock.IsolationLevel;
 import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.xml.XmlHelper;
@@ -67,7 +71,7 @@
    {
       Configuration conf = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
       CacheFactory<Object, Integer> instance = new DefaultCacheFactory();
-      cache_ = (CacheSPI)instance.createCache(conf, false);
+      cache_ = (CacheSPI) instance.createCache(conf, false);
       conf.getEvictionConfig().setWakeupIntervalSeconds(5);
       cache_.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
       cache_.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);
@@ -135,7 +139,7 @@
             topEC.getDefaultEventQueueSize());
       // Fqn is the region name
       Integer ii = 1;
-      Fqn fqn = new Fqn<Integer>(ii);
+      Fqn fqn = Fqn.fromElements(ii);
       regionManager.getRegion(fqn, true).setEvictionPolicy(erc.getEvictionPolicyConfig());
    }
 
@@ -143,12 +147,12 @@
    {
       addStringBasedRegion();
 
-      String rootStr = "/programmatic/";
+      String rootStr = "programmatic";
       for (int i = 0; i < 10; i++)
       {
          String str = rootStr;
          Integer in = i;
-         Fqn<Object> fqn = new Fqn<Object>(new Fqn<Object>(str), in);
+         Fqn fqn = Fqn.fromElements(rootStr, in);
          try
          {
             cache_.put(fqn, str, str);
@@ -161,7 +165,7 @@
       }
 
       Integer in = 3;
-      Fqn<Object> fqn = new Fqn<Object>(new Fqn<Object>(rootStr), in);
+      Fqn fqn = Fqn.fromElements(rootStr, in);
       try
       {
          String val = (String) cache_.get(fqn, in);
@@ -194,11 +198,11 @@
       addObjectBasedRegion();
 
       Integer ii = 1;
-      Fqn<Object> rootfqn = new Fqn<Object>(ii);
+      Fqn<Integer> rootfqn = Fqn.fromElements(ii);
       for (int i = 0; i < 10; i++)
       {
          Integer in = i;
-         Fqn<Object> fqn = new Fqn<Object>(rootfqn, in);
+         Fqn<Object> fqn = Fqn.fromRelativeElements(rootfqn, in);
          try
          {
             cache_.put(fqn, in, in);
@@ -213,7 +217,7 @@
       try
       {
          Integer in = 3;
-         Fqn<Object> fqn = new Fqn<Object>(rootfqn, in);
+         Fqn<Object> fqn = Fqn.fromRelativeElements(rootfqn, in);
          Object val = cache_.get(fqn, in);
          assertNotNull("DataNode should be empty ", val);
       }
@@ -229,7 +233,7 @@
       try
       {
          Integer in = 3;
-         Fqn<Object> fqn = new Fqn<Object>(rootfqn, in);
+         Fqn<Object> fqn = Fqn.fromRelativeElements(rootfqn, in);
          Object val = cache_.get(fqn, in);
          assertNull("DataNode should be empty ", val);
       }

Modified: core/trunk/src/test/java/org/jboss/cache/integration/hibernate/HibernateIntegrationTestUtil.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/integration/hibernate/HibernateIntegrationTestUtil.java	2008-04-10 23:12:19 UTC (rev 5528)
+++ core/trunk/src/test/java/org/jboss/cache/integration/hibernate/HibernateIntegrationTestUtil.java	2008-04-10 23:33:56 UTC (rev 5529)
@@ -26,18 +26,18 @@
 
 /**
  * Utilities related to the Hibernate integration tests.
- * 
+ *
  * @author Brian Stansberry
  */
 public class HibernateIntegrationTestUtil
 {
    public static final Fqn<String> TS_BASE_FQN = Fqn.fromString("/TS");
    public static final Fqn<String> REGION_PREFIX_FQN = Fqn.fromString("/test");
-   public static final Fqn<String> TS_FQN = new Fqn<String>(TS_BASE_FQN, new Fqn<String>(REGION_PREFIX_FQN, Fqn.fromString("/org/hibernate/cache/UpdateTimestampsCache")));
+   public static final Fqn TS_FQN = Fqn.fromRelativeFqn(TS_BASE_FQN, Fqn.fromRelativeFqn(REGION_PREFIX_FQN, Fqn.fromString("/org/hibernate/cache/UpdateTimestampsCache")));
    public static final String ITEM = "item";
-   
+
    /**
-    * Prevent instantiation. 
+    * Prevent instantiation.
     */
    private HibernateIntegrationTestUtil()
    {

Modified: core/trunk/src/test/java/org/jboss/cache/interceptors/EvictionInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/interceptors/EvictionInterceptorTest.java	2008-04-10 23:12:19 UTC (rev 5528)
+++ core/trunk/src/test/java/org/jboss/cache/interceptors/EvictionInterceptorTest.java	2008-04-10 23:33:56 UTC (rev 5529)
@@ -6,10 +6,22 @@
  */
 package org.jboss.cache.interceptors;
 
-import org.jboss.cache.*;
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.DefaultCacheFactory;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.Node;
+import org.jboss.cache.NodeSPI;
+import org.jboss.cache.Region;
+import org.jboss.cache.RegionManager;
 import org.jboss.cache.commands.CacheCommand;
 import org.jboss.cache.commands.CommandsFactory;
-import org.jboss.cache.commands.cachedata.*;
+import org.jboss.cache.commands.cachedata.GetKeyValueCommand;
+import org.jboss.cache.commands.cachedata.GetNodeCommand;
+import org.jboss.cache.commands.cachedata.PutDataMapCommand;
+import org.jboss.cache.commands.cachedata.PutKeyValueCommand;
+import org.jboss.cache.commands.cachedata.RemoveDataCommand;
+import org.jboss.cache.commands.cachedata.RemoveKeyCommand;
+import org.jboss.cache.commands.cachedata.RemoveNodeCommand;
 import org.jboss.cache.config.EvictionConfig;
 import org.jboss.cache.config.EvictionRegionConfig;
 import org.jboss.cache.eviction.DummyEvictionConfiguration;
@@ -176,7 +188,7 @@
       NodeSPI child = root;
       for (int i = 0; i < fqn.size(); i++)
       {
-         child = child.addChildDirect(new Fqn(fqn.get(i)));
+         child = child.addChildDirect(Fqn.fromElements(fqn.get(i)));
       }
 
       assert child.getFqn().equals(fqn);

Modified: core/trunk/src/test/java/org/jboss/cache/invalidation/InvalidationInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/invalidation/InvalidationInterceptorTest.java	2008-04-10 23:12:19 UTC (rev 5528)
+++ core/trunk/src/test/java/org/jboss/cache/invalidation/InvalidationInterceptorTest.java	2008-04-10 23:33:56 UTC (rev 5529)
@@ -515,7 +515,7 @@
       root1.addChild(fqn);
       assertEquals(true, root1.hasChild(fqn));
 
-      Fqn<String> child = new Fqn(fqn, "child");
+      Fqn child = Fqn.fromRelativeElements(fqn, "child");
       cache1.putForExternalRead(child, "key", "value");
       cache2.putForExternalRead(child, "key", "value");
       assertEquals("value", cache1.get(child, "key"));

Modified: core/trunk/src/test/java/org/jboss/cache/loader/BdbjeTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/BdbjeTest.java	2008-04-10 23:12:19 UTC (rev 5528)
+++ core/trunk/src/test/java/org/jboss/cache/loader/BdbjeTest.java	2008-04-10 23:33:56 UTC (rev 5529)
@@ -43,7 +43,7 @@
 
    private static final int STREAM_HEADER_LENGTH = 4;
    private static final String envHome = ".";
-   private static final Fqn<String> FQN = new Fqn<String>("key");
+   private static final Fqn<String> FQN = Fqn.fromString("/key");
 
    private CacheSPI cache;
    private CacheLoader loader;
@@ -222,8 +222,8 @@
       startLoader(transactional, null);
 
       /* One FQN only. */
-      doPutTests(new Fqn<String>("key"));
-      doRemoveTests(new Fqn<String>("key"));
+      doPutTests(FQN);
+      doRemoveTests(FQN);
 
       ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
       MarshalledValueOutputStream os = new MarshalledValueOutputStream(baos);
@@ -231,20 +231,24 @@
       os.close();
 
       /* Add three FQNs, middle FQN last. */
-      doPutTests(new Fqn<String>("key1"));
-      doPutTests(new Fqn<String>("key3"));
-      doPutTests(new Fqn<String>("key2"));
-      assertEquals(4, loader.get(new Fqn<String>("key1")).size());
-      assertEquals(4, loader.get(new Fqn<String>("key2")).size());
-      assertEquals(4, loader.get(new Fqn<String>("key3")).size());
+      Fqn<String> k1 = Fqn.fromString("/key1");
+      Fqn<String> k2 = Fqn.fromString("/key2");
+      Fqn<String> k3 = Fqn.fromString("/key3");
 
+      doPutTests(k1);
+      doPutTests(k3);
+      doPutTests(k2);
+      assertEquals(4, loader.get(k1).size());
+      assertEquals(4, loader.get(k2).size());
+      assertEquals(4, loader.get(k3).size());
+
       /* Remove middle FQN first, then the others. */
-      doRemoveTests(new Fqn<String>("key2"));
-      doRemoveTests(new Fqn<String>("key3"));
-      doRemoveTests(new Fqn<String>("key1"));
-      assertEquals(null, loader.get(new Fqn<String>("key1")));
-      assertEquals(null, loader.get(new Fqn<String>("key2")));
-      assertEquals(null, loader.get(new Fqn<String>("key3")));
+      doRemoveTests(k2);
+      doRemoveTests(k3);
+      doRemoveTests(k1);
+      assertEquals(null, loader.get(k1));
+      assertEquals(null, loader.get(k2));
+      assertEquals(null, loader.get(k3));
 
       baos = new ByteArrayOutputStream(1024);
       os = new MarshalledValueOutputStream(baos);
@@ -334,11 +338,16 @@
       startLoader(false, null);
 
       /* Create top level node implicitly. */
-      assertTrue(!loader.exists(new Fqn<String>("key0")));
+      Fqn k0 = Fqn.fromString("/key0");
+      Fqn k1 = Fqn.fromString("/key1");
+      Fqn k2 = Fqn.fromString("/key2");
+      Fqn k3 = Fqn.fromString("/key3");
+
+      assertTrue(!loader.exists(k0));
       loader.put(Fqn.fromString("/key0/level1/level2"), null);
       assertTrue(loader.exists(Fqn.fromString("/key0/level1/level2")));
       assertTrue(loader.exists(Fqn.fromString("/key0/level1")));
-      assertTrue(loader.exists(new Fqn<String>("key0")));
+      assertTrue(loader.exists(k0));
 
       /* Remove leaf, leaving implicitly created middle level. */
       loader.put(Fqn.fromString("/key0/x/y"), null);
@@ -349,19 +358,19 @@
       assertTrue(loader.exists(Fqn.fromString("/key0/x")));
 
       /* Delete top level to delete everything. */
-      loader.remove(new Fqn<String>("key0"));
-      assertTrue(!loader.exists(new Fqn<String>("key0")));
+      loader.remove(k0);
+      assertTrue(!loader.exists(k0));
       assertTrue(!loader.exists(Fqn.fromString("/key0/level1/level2")));
       assertTrue(!loader.exists(Fqn.fromString("/key0/level1")));
       assertTrue(!loader.exists(Fqn.fromString("/key0/x")));
 
       /* Add three top level nodes as context. */
-      loader.put(new Fqn<String>("key1"), null);
-      loader.put(new Fqn<String>("key2"), null);
-      loader.put(new Fqn<String>("key3"), null);
-      assertTrue(loader.exists(new Fqn<String>("key1")));
-      assertTrue(loader.exists(new Fqn<String>("key2")));
-      assertTrue(loader.exists(new Fqn<String>("key3")));
+      loader.put(k1, null);
+      loader.put(k2, null);
+      loader.put(k3, null);
+      assertTrue(loader.exists(k1));
+      assertTrue(loader.exists(k2));
+      assertTrue(loader.exists(k3));
 
       /* Put /key3/level1/level2.  level1 should be implicitly created. */
       assertTrue(!loader.exists(Fqn.fromString("/key3/level1")));
@@ -371,9 +380,9 @@
       assertTrue(loader.exists(Fqn.fromString("/key3/level1")));
 
       /* Context nodes should still be intact. */
-      assertTrue(loader.exists(new Fqn<String>("key1")));
-      assertTrue(loader.exists(new Fqn<String>("key2")));
-      assertTrue(loader.exists(new Fqn<String>("key3")));
+      assertTrue(loader.exists(k1));
+      assertTrue(loader.exists(k2));
+      assertTrue(loader.exists(k3));
 
       /* Remove middle level only. */
       loader.remove(Fqn.fromString("/key3/level1"));
@@ -381,37 +390,37 @@
       assertTrue(!loader.exists(Fqn.fromString("/key3/level1")));
 
       /* Context nodes should still be intact. */
-      assertTrue(loader.exists(new Fqn<String>("key1")));
-      assertTrue(loader.exists(new Fqn<String>("key2")));
-      assertTrue(loader.exists(new Fqn<String>("key3")));
+      assertTrue(loader.exists(k1));
+      assertTrue(loader.exists(k2));
+      assertTrue(loader.exists(k3));
 
       /* Delete first root, leaving other roots. */
-      loader.remove(new Fqn<String>("key1"));
-      assertTrue(!loader.exists(new Fqn<String>("key1")));
-      assertTrue(loader.exists(new Fqn<String>("key2")));
-      assertTrue(loader.exists(new Fqn<String>("key3")));
+      loader.remove(k1);
+      assertTrue(!loader.exists(k1));
+      assertTrue(loader.exists(k2));
+      assertTrue(loader.exists(k3));
 
       /* Delete last root, leaving other roots. */
-      loader.remove(new Fqn<String>("key3"));
-      assertTrue(loader.exists(new Fqn<String>("key2")));
-      assertTrue(!loader.exists(new Fqn<String>("key3")));
+      loader.remove(k3);
+      assertTrue(loader.exists(k2));
+      assertTrue(!loader.exists(k3));
 
       /* Delete final root, leaving none. */
-      loader.remove(new Fqn<String>("key2"));
-      assertTrue(!loader.exists(new Fqn<String>("key0")));
-      assertTrue(!loader.exists(new Fqn<String>("key1")));
-      assertTrue(!loader.exists(new Fqn<String>("key2")));
-      assertTrue(!loader.exists(new Fqn<String>("key3")));
+      loader.remove(k2);
+      assertTrue(!loader.exists(k0));
+      assertTrue(!loader.exists(k1));
+      assertTrue(!loader.exists(k2));
+      assertTrue(!loader.exists(k3));
 
       /* Repeat all tests above using put(Fqn,Object,Object) and get(Fqn) */
 
-      assertNull(loader.get(new Fqn<String>("key0")));
+      assertNull(loader.get(k0));
       loader.put(Fqn.fromString("/key0/level1/level2"), "a", "b");
       assertNotNull(loader.get(Fqn.fromString("/key0/level1/level2")));
       assertNotNull(loader.get(Fqn.fromString("/key0/level1")));
-      assertNotNull(loader.get(new Fqn<String>("key0")));
+      assertNotNull(loader.get(k0));
       assertEquals(0, loader.get(Fqn.fromString("/key0/level1")).size());
-      assertEquals(0, loader.get(new Fqn<String>("key0")).size());
+      assertEquals(0, loader.get(k0).size());
 
 
       loader.put(Fqn.fromString("/key0/x/y"), "a", "b");
@@ -423,18 +432,18 @@
       assertNotNull(loader.get(Fqn.fromString("/key0/x")));
       assertEquals(0, loader.get(Fqn.fromString("/key0/x")).size());
 
-      loader.remove(new Fqn<String>("key0"));
-      assertNull(loader.get(new Fqn<String>("key0")));
+      loader.remove(k0);
+      assertNull(loader.get(k0));
       assertNull(loader.get(Fqn.fromString("/key0/level1/level2")));
       assertNull(loader.get(Fqn.fromString("/key0/level1")));
       assertNull(loader.get(Fqn.fromString("/key0/x")));
 
-      loader.put(new Fqn<String>("key1"), "a", "b");
-      loader.put(new Fqn<String>("key2"), "a", "b");
-      loader.put(new Fqn<String>("key3"), "a", "b");
-      assertNotNull(loader.get(new Fqn<String>("key1")));
-      assertNotNull(loader.get(new Fqn<String>("key2")));
-      assertNotNull(loader.get(new Fqn<String>("key3")));
+      loader.put(k1, "a", "b");
+      loader.put(k2, "a", "b");
+      loader.put(k3, "a", "b");
+      assertNotNull(loader.get(k1));
+      assertNotNull(loader.get(k2));
+      assertNotNull(loader.get(k3));
 
       assertNull(loader.get(Fqn.fromString("/key3/level1")));
       assertNull(loader.get(Fqn.fromString("/key3/level1/level2")));
@@ -443,32 +452,32 @@
       assertNotNull(loader.get(Fqn.fromString("/key3/level1")));
       assertEquals(0, loader.get(Fqn.fromString("/key3/level1")).size());
 
-      assertNotNull(loader.get(new Fqn<String>("key1")));
-      assertNotNull(loader.get(new Fqn<String>("key2")));
-      assertNotNull(loader.get(new Fqn<String>("key3")));
+      assertNotNull(loader.get(k1));
+      assertNotNull(loader.get(k2));
+      assertNotNull(loader.get(k3));
 
       loader.remove(Fqn.fromString("/key3/level1"));
       assertNull(loader.get(Fqn.fromString("/key3/level1/level2")));
       assertNull(loader.get(Fqn.fromString("/key3/level1")));
 
-      assertNotNull(loader.get(new Fqn<String>("key1")));
-      assertNotNull(loader.get(new Fqn<String>("key2")));
-      assertNotNull(loader.get(new Fqn<String>("key3")));
+      assertNotNull(loader.get(k1));
+      assertNotNull(loader.get(k2));
+      assertNotNull(loader.get(k3));
 
-      loader.remove(new Fqn<String>("key1"));
-      assertNull(loader.get(new Fqn<String>("key1")));
-      assertNotNull(loader.get(new Fqn<String>("key2")));
-      assertNotNull(loader.get(new Fqn<String>("key3")));
+      loader.remove(k1);
+      assertNull(loader.get(k1));
+      assertNotNull(loader.get(k2));
+      assertNotNull(loader.get(k3));
 
-      loader.remove(new Fqn<String>("key3"));
-      assertNotNull(loader.get(new Fqn<String>("key2")));
-      assertNull(loader.get(new Fqn<String>("key3")));
+      loader.remove(k3);
+      assertNotNull(loader.get(k2));
+      assertNull(loader.get(k3));
 
-      loader.remove(new Fqn<String>("key2"));
-      assertNull(loader.get(new Fqn<String>("key0")));
-      assertNull(loader.get(new Fqn<String>("key1")));
-      assertNull(loader.get(new Fqn<String>("key2")));
-      assertNull(loader.get(new Fqn<String>("key3")));
+      loader.remove(k2);
+      assertNull(loader.get(k0));
+      assertNull(loader.get(k1));
+      assertNull(loader.get(k2));
+      assertNull(loader.get(k3));
 
       stopLoader();
    }

Modified: core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderConnectionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderConnectionTest.java	2008-04-10 23:12:19 UTC (rev 5528)
+++ core/trunk/src/test/java/org/jboss/cache/loader/JDBCCacheLoaderConnectionTest.java	2008-04-10 23:33:56 UTC (rev 5529)
@@ -52,7 +52,7 @@
       cache.removeNode(Fqn.fromString("C"));
       for (int i = 0; i < 100; i++)
       {
-         cache.put(new Fqn("C", Integer.toString(i)), "Blah", Integer.toString(i));
+         cache.put(Fqn.fromElements("C", Integer.toString(i)), "Blah", Integer.toString(i));
          System.out.println("added " + i + " dummy node to Jboss cache.");
       }
 

Modified: core/trunk/src/test/java/org/jboss/cache/loader/TcpCacheServerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/TcpCacheServerTest.java	2008-04-10 23:12:19 UTC (rev 5528)
+++ core/trunk/src/test/java/org/jboss/cache/loader/TcpCacheServerTest.java	2008-04-10 23:33:56 UTC (rev 5529)
@@ -6,8 +6,8 @@
 import org.jboss.cache.Fqn;
 import org.jboss.cache.config.CacheLoaderConfig;
 import org.jboss.cache.config.Configuration;
+import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
 import org.jboss.cache.factories.XmlConfigurationParser;
-import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
 import org.jboss.cache.jmx.CacheJmxWrapper;
 import org.jboss.cache.loader.tcp.TcpCacheServer;
 import org.jboss.cache.misc.TestingUtil;
@@ -180,7 +180,7 @@
 
    private void usabilityCheck() throws Exception
    {
-      Fqn<String> fqn = new Fqn<String>("key");
+      Fqn<String> fqn = Fqn.fromString("/key");
       assertFalse("Fqn does not exist in loader", loader.exists(fqn));
 
       /* put(Fqn,Object,Object) and get(Fqn,Object) */

Modified: core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshallerTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshallerTestBase.java	2008-04-10 23:12:19 UTC (rev 5528)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshallerTestBase.java	2008-04-10 23:33:56 UTC (rev 5529)
@@ -8,11 +8,12 @@
 
 import org.jboss.cache.Fqn;
 import org.jboss.cache.RegionManager;
+import org.jboss.cache.commands.CacheCommand;
 import org.jboss.cache.commands.CommandsFactory;
-import org.jboss.cache.commands.CacheCommand;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.factories.ComponentRegistry;
-import static org.testng.AssertJUnit.*;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
@@ -114,7 +115,7 @@
 
    public void testStringBasedFqn() throws Exception
    {
-      Fqn fqn = new Fqn<Object>("JSESSIONID", "1010.10.5:3000", "1234567890", "1");
+      Fqn fqn = Fqn.fromElements("JSESSIONID", "1010.10.5:3000", "1234567890", "1");
       byte[] asBytes = marshaller.objectToByteBuffer(fqn);
       System.out.println("Marshalled to " + asBytes.length + " bytes");
       Object o2 = marshaller.objectFromByteBuffer(asBytes);
@@ -123,7 +124,7 @@
 
    public void testNonStringBasedFqn() throws Exception
    {
-      Fqn fqn = new Fqn<Object>(3, false);
+      Fqn fqn = Fqn.fromElements(3, false);
       byte[] asBytes = marshaller.objectToByteBuffer(fqn);
       Object o2 = marshaller.objectFromByteBuffer(asBytes);
       assertEquals(fqn, o2);
@@ -131,7 +132,7 @@
 
    public void testMethodCall() throws Exception
    {
-      Fqn fqn = new Fqn<Object>(3, false);
+      Fqn fqn = Fqn.fromElements(3, false);
       MethodCall call = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal_id, fqn, "key", "value", true);
       byte[] asBytes = marshaller.objectToByteBuffer(call);
       Object o2 = marshaller.objectFromByteBuffer(asBytes);
@@ -145,7 +146,7 @@
 
    public void testNestedMethodCall() throws Exception
    {
-      Fqn fqn = new Fqn<Object>(3, false);
+      Fqn fqn = Fqn.fromElements(3, false);
       MethodCall call = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal_id, fqn, "key", "value", true);
       MethodCall replicateCall = MethodCallFactory.create(MethodDeclarations.replicateMethod_id, call);
       byte[] asBytes = marshaller.objectToByteBuffer(replicateCall);
@@ -250,7 +251,7 @@
       MethodCall call = MethodCallFactory.create(MethodDeclarations.replicateAllMethod_id, calls);
 
       byte[] buf = marshaller.objectToByteBuffer(call);
-        //todo - revisit after refactoring
+      //todo - revisit after refactoring
 //      assertMethodCallsEquals(call, (MethodCall) marshaller.objectFromByteBuffer(buf));
    }
 

Modified: core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerTest.java	2008-04-10 23:12:19 UTC (rev 5528)
+++ core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerTest.java	2008-04-10 23:33:56 UTC (rev 5529)
@@ -258,7 +258,7 @@
 
       cache.move(n1.getFqn(), n2.getFqn());
       //expected
-      Fqn<String> newFqn = new Fqn<String>(newParent, fqn.getLastElement());
+      Fqn newFqn = Fqn.fromRelativeElements(newParent, fqn.getLastElement());
       List<Event> expected = new ArrayList<Event>();
 
       if (optLocking)
@@ -444,7 +444,7 @@
       Transaction tx = tm.getTransaction();
       cache.move(n1.getFqn(), n2.getFqn());
       //expected
-      Fqn<String> newFqn = new Fqn<String>(newParent, fqn.getLastElement());
+      Fqn newFqn = Fqn.fromRelativeElements(newParent, fqn.getLastElement());
       List<Event> expected = new ArrayList<Event>();
       expected.add(new EventImpl(false, cache, null, null, null, tx, true, null, false, null, TRANSACTION_REGISTERED));
       expected.add(new EventImpl(true, cache, null, null, fqn, tx, true, newFqn, false, null, NODE_MOVED));

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/ComparatorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/ComparatorTest.java	2008-04-10 23:12:19 UTC (rev 5528)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/ComparatorTest.java	2008-04-10 23:33:56 UTC (rev 5529)
@@ -43,10 +43,10 @@
 
    public void testOneNullCompare()
    {
-      Fqn<String> fqn1 = new Fqn<String>(new ArrayList<String>());
+      Fqn<String> fqn1 = Fqn.fromList(new ArrayList<String>());
       List<String> temp = new ArrayList<String>();
       temp.add("one");
-      Fqn<String> fqn2 = new Fqn<String>(temp);
+      Fqn<String> fqn2 = Fqn.fromList(temp);
 
       assertTrue(comp.compare(fqn1, fqn2) < 0);
       assertTrue(comp.compare(fqn2, fqn1) > 0);
@@ -54,11 +54,11 @@
 
    public void testNotComparableCompare()
    {
-      Fqn<String> fqn1 = new Fqn<String>(new ArrayList<String>());
+      Fqn<String> fqn1 = Fqn.fromList(new ArrayList<String>());
 
       List<String> temp = new ArrayList<String>();
       temp.add("one");
-      Fqn fqn2 = new Fqn<String>(temp);
+      Fqn fqn2 = Fqn.fromList(temp);
 
       assertTrue(comp.compare(fqn1, fqn2) < 0);
       assertTrue(comp.compare(fqn2, fqn1) > 0);
@@ -130,7 +130,7 @@
 
       List<Object> temp = new ArrayList<Object>();
       temp.add(1234);
-      Fqn<Object> fqn2 = new Fqn<Object>(temp);
+      Fqn<Object> fqn2 = Fqn.fromList(temp);
 
       assertTrue(comp.compare(fqn1, fqn2) > 0);
       assertTrue(comp.compare(fqn2, fqn1) < 0);
@@ -142,11 +142,11 @@
 
    public void testOrdinaryObjectCompare()
    {
-      Fqn<Object> fqn1 = new Fqn<Object>(new XYZ(), new ABC());
-      Fqn<Object> fqn2 = new Fqn<Object>("XYZ", "ABC");
-      Fqn<Object> fqn3 = new Fqn<Object>("XYZ", new ABC());
+      Fqn<Object> fqn1 = Fqn.fromElements(new XYZ(), new ABC());
+      Fqn fqn2 = Fqn.fromElements("XYZ", "ABC");
+      Fqn<Object> fqn3 = Fqn.fromElements("XYZ", new ABC());
 
-      Fqn<Object> fqn4 = new Fqn<Object>("XYZ", new XYZ());
+      Fqn<Object> fqn4 = Fqn.fromElements("XYZ", new XYZ());
 
       assertEquals(0, comp.compare(fqn1, fqn2));
       assertEquals(0, comp.compare(fqn1, fqn3));
@@ -155,23 +155,9 @@
       assertEquals(true, comp.compare(fqn4, fqn1) > 0);
    }
 
-   /*
-   public void testNullComparator()
-   {
-       Fqn fqn1 = new Fqn(new Object[] {"a", null, "c"});
-       Fqn fqn2 = new Fqn(new Object[] {"a", "d", "c"});
-       Fqn fqn3 = new Fqn(new Object[] {"a", null});
-
-       assertEquals(0, comp.compare(fqn1, fqn1));
-       assertEquals(true, comp.compare(fqn1, fqn2) > 0);
-       assertEquals(true, comp.compare(fqn2, fqn1) < 0);
-       assertEquals(true, comp.compare(fqn1, fqn3) < 0);
-       assertEquals(true, comp.compare(fqn3, fqn1) > 0);
-   }
-   */
-
    private static class XYZ
    {
+      @Override
       public String toString()
       {
          return "XYZ";
@@ -180,6 +166,7 @@
 
    private static class ABC
    {
+      @Override
       public String toString()
       {
          return "ABC";

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/ConcurrentTransactionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/ConcurrentTransactionTest.java	2008-04-10 23:12:19 UTC (rev 5528)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/ConcurrentTransactionTest.java	2008-04-10 23:33:56 UTC (rev 5529)
@@ -338,7 +338,7 @@
          try
          {
             cache.getTransactionManager().begin();
-            cache.put(new Fqn<String>(f, getName()), "a", "b");
+            cache.put(Fqn.fromRelativeElements(f, getName()), "a", "b");
             cache.getTransactionManager().commit();
          }
          catch (Exception e)

Modified: core/trunk/src/test/java/org/jboss/cache/passivation/ConcurrentPassivationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/passivation/ConcurrentPassivationTest.java	2008-04-10 23:12:19 UTC (rev 5528)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/ConcurrentPassivationTest.java	2008-04-10 23:33:56 UTC (rev 5529)
@@ -62,13 +62,13 @@
 
    public void testConcurrentPassivation() throws Exception
    {
-      Fqn<Object> base = new Fqn<Object>("/org/jboss/test/data/concurrent/passivation");
+      Fqn base = Fqn.fromElements("/org/jboss/test/data/concurrent/passivation");
 
       // Create a bunch of nodes; more than the /org/jboss/test/data
       // region's maxNodes so we know eviction will kick in
       for (int i = 0; i < 35000; i++)
       {
-         cache.put(new Fqn<Object>(base, i / 100), i, "value");
+         cache.put(Fqn.fromRelativeElements(base, i / 100), i, "value");
       }
 
       // Loop for long enough to have 5 runs of the eviction thread
@@ -81,7 +81,7 @@
          // If any get returns null, that's a failure
          for (int i = 0; i < 35000; i++)
          {
-            Fqn<Object> fqn = new Fqn<Object>(base, i / 100);
+            Fqn<Object> fqn = Fqn.fromRelativeElements(base, i / 100);
             assertNotNull("Get on Fqn " + fqn + " returned null", cache.getNode(fqn));
          }
       }

Modified: core/trunk/src/test/java/org/jboss/cache/passivation/PassivationActivationCallbacksTestCase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/passivation/PassivationActivationCallbacksTestCase.java	2008-04-10 23:12:19 UTC (rev 5528)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/PassivationActivationCallbacksTestCase.java	2008-04-10 23:33:56 UTC (rev 5529)
@@ -123,7 +123,7 @@
 
    public void testSimpleLifecycle() throws Exception
    {
-      Fqn<String> fqn = new Fqn<String>(BASE, "bean1");
+      Fqn fqn = Fqn.fromRelativeElements(BASE, "bean1");
       cache.put(fqn, "bean", "A bean");
 
       //TestingUtil.sleepThread(3000);

Modified: core/trunk/src/test/java/org/jboss/cache/passivation/PassivationTestsBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/passivation/PassivationTestsBase.java	2008-04-10 23:12:19 UTC (rev 5528)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/PassivationTestsBase.java	2008-04-10 23:33:56 UTC (rev 5529)
@@ -977,12 +977,14 @@
    {
 
       /* Create top level node implicitly. */
-      assertTrue(!loader.exists(new Fqn<String>("key0")));
+      Fqn k0 = Fqn.fromString("/key0");
+
+      assertTrue(!loader.exists(k0));
       loader.put(Fqn.fromString("/key0/level1/level2"), null);
       addDelay();
       assertTrue(loader.exists(Fqn.fromString("/key0/level1/level2")));
       assertTrue(loader.exists(Fqn.fromString("/key0/level1")));
-      assertTrue(loader.exists(new Fqn<String>("key0")));
+      assertTrue(loader.exists(k0));
 
       /* Remove leaf, leaving implicitly created middle level. */
       loader.put(Fqn.fromString("/key0/x/y"), null);
@@ -995,9 +997,9 @@
       assertTrue(loader.exists(Fqn.fromString("/key0/x")));
 
       /* Delete top level to delete everything. */
-      loader.remove(new Fqn<String>("key0"));
+      loader.remove(k0);
       addDelay();
-      assertTrue(!loader.exists(new Fqn<String>("key0")));
+      assertTrue(!loader.exists(k0));
       assertTrue(!loader.exists(Fqn.fromString("/key0/level1/level2")));
       assertTrue(!loader.exists(Fqn.fromString("/key0/level1")));
       assertTrue(!loader.exists(Fqn.fromString("/key0/x")));
@@ -1051,20 +1053,20 @@
       /* Delete final root, leaving none. */
       loader.remove(Fqn.fromString("/key2"));
       addDelay();
-      assertTrue(!loader.exists(new Fqn<String>("key0")));
+      assertTrue(!loader.exists(k0));
       assertTrue(!loader.exists(Fqn.fromString("/key1")));
       assertTrue(!loader.exists(Fqn.fromString("/key2")));
       assertTrue(!loader.exists(Fqn.fromString("/key3")));
 
       /* Repeat all tests above using put(Fqn,Object,Object) and get(Fqn) */
 
-      assertNull(loader.get(new Fqn<String>("key0")));
+      assertNull(loader.get(k0));
       loader.put(Fqn.fromString("/key0/level1/level2"), "a", "b");
       addDelay();
       assertNotNull(loader.get(Fqn.fromString("/key0/level1/level2")));
       assertNotNull(loader.get(Fqn.fromString("/key0/level1")));
       assertTrue(loader.get(Fqn.fromString("/key0/level1")).isEmpty());
-      assertNotNull(loader.get(new Fqn<String>("key0")));
+      assertNotNull(loader.get(k0));
       assertTrue(loader.get(Fqn.fromString("/key0")).isEmpty());
 
       loader.put(Fqn.fromString("/key0/x/y"), "a", "b");
@@ -1078,9 +1080,9 @@
       assertNotNull(loader.get(Fqn.fromString("/key0/x")));
       assertTrue(loader.get(Fqn.fromString("/key0/x")).isEmpty());
 
-      loader.remove(new Fqn<String>("key0"));
+      loader.remove(k0);
       addDelay();
-      assertNull(loader.get(new Fqn<String>("key0")));
+      assertNull(loader.get(k0));
       assertNull(loader.get(Fqn.fromString("/key0/level1/level2")));
       assertNull(loader.get(Fqn.fromString("/key0/level1")));
       assertNull(loader.get(Fqn.fromString("/key0/x")));
@@ -1127,7 +1129,7 @@
 
       loader.remove(Fqn.fromString("/key2"));
       addDelay();
-      assertNull(loader.get(new Fqn<String>("key0")));
+      assertNull(loader.get(k0));
       assertNull(loader.get(Fqn.fromString("/key1")));
       assertNull(loader.get(Fqn.fromString("/key2")));
       assertNull(loader.get(Fqn.fromString("/key3")));
@@ -1140,21 +1142,21 @@
          throws Exception
    {
 
-      checkChildren(new Fqn(), null);
+      checkChildren(Fqn.ROOT, null);
       checkChildren(Fqn.fromString("/key0"), null);
 
       loader.put(Fqn.fromString("/key0"), null);
       addDelay();
-      checkChildren(new Fqn(), new String[]{"key0"});
+      checkChildren(Fqn.ROOT, new String[]{"key0"});
 
       loader.put(Fqn.fromString("/key1/x"), null);
       addDelay();
-      checkChildren(new Fqn(), new String[]{"key0", "key1"});
+      checkChildren(Fqn.ROOT, new String[]{"key0", "key1"});
       checkChildren(Fqn.fromString("/key1"), new String[]{"x"});
 
       loader.remove(Fqn.fromString("/key1/x"));
       addDelay();
-      checkChildren(new Fqn(), new String[]{"key0", "key1"});
+      checkChildren(Fqn.ROOT, new String[]{"key0", "key1"});
       checkChildren(Fqn.fromString("/key0"), null);
       checkChildren(Fqn.fromString("/key1"), null);
 

Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/ForcedStateTransferTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/ForcedStateTransferTest.java	2008-04-10 23:12:19 UTC (rev 5528)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/ForcedStateTransferTest.java	2008-04-10 23:33:56 UTC (rev 5529)
@@ -103,7 +103,7 @@
       {
          this.cache = cache;
          this.value = value;
-         this.fqn = new Fqn<String>(Fqn.fromString(rootFqn), value);
+         this.fqn = Fqn.fromRelativeElements(Fqn.fromString(rootFqn), value);
       }
 
       public void run()

Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferConcurrencyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferConcurrencyTest.java	2008-04-10 23:12:19 UTC (rev 5528)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransferConcurrencyTest.java	2008-04-10 23:33:56 UTC (rev 5529)
@@ -145,7 +145,7 @@
 
             for (int j = 0; j < count; j++)
             {
-               Fqn fqn = new Fqn<String>(A_B, names[j]);
+               Fqn fqn = Fqn.fromRelativeElements(A_B, names[j]);
                assertEquals("Incorrect value for " + fqn + " on activator " + names[i],
                      "VALUE", activators[i].getCacheValue(fqn));
                //               System.out.println(names[i] + ":" + fqn + " = " + activators[i].getCacheValue(fqn));
@@ -672,7 +672,7 @@
          createAndActivateRegion(cache, A_B);
 //         waitUntillAllChachesActivatedRegion();
          System.out.println(name + " activated region" + " " + System.currentTimeMillis());
-         Fqn<String> childFqn = new Fqn<String>(A_B, name);
+         Fqn childFqn = Fqn.fromRelativeElements(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/transaction/IsolationLevelReadCommittedNodeCreationRollbackTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedNodeCreationRollbackTest.java	2008-04-10 23:12:19 UTC (rev 5528)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedNodeCreationRollbackTest.java	2008-04-10 23:33:56 UTC (rev 5529)
@@ -93,7 +93,7 @@
                System.out.println("Writing /a/1");
 
                // Create an empty parent node and a node with data
-               Fqn<String> a1 = new Fqn<String>(PARENT, "1");
+               Fqn a1 = Fqn.fromRelativeElements(PARENT, "1");
                cache.put(a1, KEY, VALUE);
 
                // notify the second thread it can write
@@ -145,7 +145,7 @@
                System.out.println("writing a2");
 
                // create a second child under parent
-               Fqn<String> a2 = new Fqn<String>(PARENT, "2");
+               Fqn a2 = Fqn.fromRelativeElements(PARENT, "2");
                try
                {
                   cache.put(a2, KEY, VALUE);




More information about the jbosscache-commits mailing list