[jbosscache-commits] JBoss Cache SVN: r5530 - in core/trunk/src/test/java/org/jboss/cache: buddyreplication and 4 other directories.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Fri Apr 11 07:29:00 EDT 2008


Author: manik.surtani at jboss.com
Date: 2008-04-11 07:29:00 -0400 (Fri, 11 Apr 2008)
New Revision: 5530

Modified:
   core/trunk/src/test/java/org/jboss/cache/TreeNodeTest.java
   core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationFailoverTest.java
   core/trunk/src/test/java/org/jboss/cache/eviction/ConcurrentEvictionTest.java
   core/trunk/src/test/java/org/jboss/cache/loader/BdbjeTest.java
   core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderTestsBase.java
   core/trunk/src/test/java/org/jboss/cache/loader/ClusteredCacheLoaderTest.java
   core/trunk/src/test/java/org/jboss/cache/marshall/ActiveInactiveTest.java
   core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshallerTestBase.java
   core/trunk/src/test/java/org/jboss/cache/transaction/ReplicatedTransactionDeadlockTest.java
   core/trunk/src/test/java/org/jboss/cache/transaction/TransactionTest.java
Log:
Updated code that uses deprecated Fqn constructors

Modified: core/trunk/src/test/java/org/jboss/cache/TreeNodeTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/TreeNodeTest.java	2008-04-10 23:33:56 UTC (rev 5529)
+++ core/trunk/src/test/java/org/jboss/cache/TreeNodeTest.java	2008-04-11 11:29:00 UTC (rev 5530)
@@ -36,12 +36,12 @@
       cache.put(Fqn.fromString("/a/b/c"), key, "test");
       Node<Object, Object> node = cache.getNode(Fqn.fromString("/a/b"));
       assertFalse(node.getChildren().isEmpty());
-      assertTrue(node.getChild(new Fqn<String>("c")) != null);
+      assertTrue(node.getChild(Fqn.fromElements("c")) != null);
 
       Fqn fqn = Fqn.fromString("/e/f");
       cache.put(fqn, "1", "1");
       node = cache.getNode(Fqn.fromString("/e"));
       assertFalse(node.getChildren().isEmpty());
-      assertTrue(node.getChild(new Fqn<String>("f")) != null);
+      assertTrue(node.getChild(Fqn.fromElements("f")) != null);
    }
 }
\ No newline at end of file

Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationFailoverTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationFailoverTest.java	2008-04-10 23:33:56 UTC (rev 5529)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationFailoverTest.java	2008-04-11 11:29:00 UTC (rev 5530)
@@ -73,12 +73,12 @@
          assert caches.get(1).peek(BuddyManager.getBackupRoot(caches.get(2).getLocalAddress()), false) != null : "Should have new buddy's backup root.";
          assert caches.get(1).peek(BuddyManager.getBackupRoot(caches.get(1).getLocalAddress()), false) == null : "Should not have self as a backup root.";
          assert caches.get(1).peek(BuddyManager.getBackupRoot(caches.get(0).getLocalAddress()), false) == null : "Should not have dead node as a backup root.";
-         assert caches.get(1).peek(new Fqn(BuddyManager.getDeadBackupRoot(caches.get(0).getLocalAddress()), new Integer(1)), false) != null : "Should have dead node as a defunct backup root.";
+         assert caches.get(1).peek(Fqn.fromRelativeElements(BuddyManager.getDeadBackupRoot(caches.get(0).getLocalAddress()), 1), false) != null : "Should have dead node as a defunct backup root.";
 
          assert caches.get(2).peek(BuddyManager.getBackupRoot(caches.get(2).getLocalAddress()), false) == null : "Should not have self as a backup root.";
          assert caches.get(2).peek(BuddyManager.getBackupRoot(caches.get(1).getLocalAddress()), false) != null : "Should have new buddy's backup root.";
          assert caches.get(2).peek(BuddyManager.getBackupRoot(caches.get(0).getLocalAddress()), false) == null : "Should not have dead node as a backup root.";
-         assert caches.get(2).peek(new Fqn(BuddyManager.getDeadBackupRoot(caches.get(0).getLocalAddress()), new Integer(1)), false) == null : "Should not have dead node as a defunct backup root.";
+         assert caches.get(2).peek(Fqn.fromRelativeElements(BuddyManager.getDeadBackupRoot(caches.get(0).getLocalAddress()), 1), false) == null : "Should not have dead node as a defunct backup root.";
       }
 
       System.out.println("***** Killed original data owner, about to call a get on a different cache instance.  *****");
@@ -103,13 +103,13 @@
          assert caches.get(1).peek(BuddyManager.getBackupRoot(caches.get(2).getLocalAddress()), false) != null : "Should have new buddy's backup root.";
          assert caches.get(1).peek(BuddyManager.getBackupRoot(caches.get(1).getLocalAddress()), false) == null : "Should not have self as a backup root.";
          assert caches.get(1).peek(BuddyManager.getBackupRoot(caches.get(0).getLocalAddress()), false) == null : "Should not have dead node as a backup root.";
-         assert caches.get(1).peek(new Fqn(BuddyManager.getDeadBackupRoot(caches.get(0).getLocalAddress()), new Integer(1)), false) == null : "Should not have dead node as a defunct backup root.";
+         assert caches.get(1).peek(Fqn.fromRelativeElements(BuddyManager.getDeadBackupRoot(caches.get(0).getLocalAddress()), 1), false) == null : "Should not have dead node as a defunct backup root.";
          assert caches.get(1).peek(BuddyManager.getDeadBackupRoot(caches.get(0).getLocalAddress()), false) == null : "Should not have dead node as a defunct backup root.";
 
          assert caches.get(2).peek(BuddyManager.getBackupRoot(caches.get(2).getLocalAddress()), false) == null : "Should not have self as a backup root.";
          assert caches.get(2).peek(BuddyManager.getBackupRoot(caches.get(1).getLocalAddress()), false) != null : "Should have new buddy's backup root.";
          assert caches.get(2).peek(BuddyManager.getBackupRoot(caches.get(0).getLocalAddress()), false) == null : "Should not have dead node as a backup root.";
-         assert caches.get(2).peek(new Fqn(BuddyManager.getDeadBackupRoot(caches.get(0).getLocalAddress()), new Integer(1)), false) == null : "Should not have dead node as a defunct backup root.";
+         assert caches.get(2).peek(Fqn.fromRelativeElements(BuddyManager.getDeadBackupRoot(caches.get(0).getLocalAddress()), 1), false) == null : "Should not have dead node as a defunct backup root.";
       }
       assertTrue("Should be false", !caches.get(1).exists(fqn));
 

Modified: core/trunk/src/test/java/org/jboss/cache/eviction/ConcurrentEvictionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/ConcurrentEvictionTest.java	2008-04-10 23:33:56 UTC (rev 5529)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/ConcurrentEvictionTest.java	2008-04-11 11:29:00 UTC (rev 5530)
@@ -11,8 +11,11 @@
 import org.jboss.cache.CacheFactory;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
+import org.jboss.cache.config.CacheLoaderConfig;
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.config.EvictionConfig;
+import org.jboss.cache.config.EvictionRegionConfig;
 import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
-import org.jboss.cache.config.*;
 import org.jboss.cache.misc.TestingUtil;
 import static org.testng.AssertJUnit.assertNotNull;
 import static org.testng.AssertJUnit.fail;
@@ -20,10 +23,10 @@
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Properties;
-import java.util.List;
-import java.util.ArrayList;
-import java.io.IOException;
 
 /**
  * Tests cache behavior in the presence of concurrent passivation.
@@ -72,7 +75,7 @@
       CacheLoaderConfig.IndividualCacheLoaderConfig iclc = new CacheLoaderConfig.IndividualCacheLoaderConfig();
       iclc.setClassName("org.jboss.cache.loader.FileCacheLoader");
       Properties p = new Properties();
-      p.put("location", tmpDir + cacheLoaderDir);      
+      p.put("location", tmpDir + cacheLoaderDir);
       iclc.setProperties(p);
       iclc.setAsync(false);
       iclc.setFetchPersistentState(true);
@@ -87,7 +90,7 @@
       ec.setDefaultEvictionPolicyClass("org.jboss.cache.eviction.LRUPolicy");
       ec.setWakeupIntervalSeconds(5);
 
-      EvictionRegionConfig erc = UnitTestCacheConfigurationFactory.buildLruEvictionRegionConfig("_default_", 5000, 1000);      
+      EvictionRegionConfig erc = UnitTestCacheConfigurationFactory.buildLruEvictionRegionConfig("_default_", 5000, 1000);
       List<EvictionRegionConfig> erConfigs = new ArrayList<EvictionRegionConfig>();
       erConfigs.add(erc);
       ec.setEvictionRegionConfigs(erConfigs);
@@ -110,7 +113,7 @@
       // region's maxNodes so we know eviction will kick in
       for (int i = 0; i < 1000; 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
@@ -120,7 +123,7 @@
          // If any get returns null, that's a failure
          for (int i = 0; i < 1000; i++)
          {
-            Fqn<Object> fqn = new Fqn<Object>(base, i / 100);
+            Fqn<Object> fqn = Fqn.fromRelativeElements(base, i / 100);
             Integer key = i;
             assertNotNull("found value under Fqn " + fqn + " and key " + key,
                   cache_.get(fqn, 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:33:56 UTC (rev 5529)
+++ core/trunk/src/test/java/org/jboss/cache/loader/BdbjeTest.java	2008-04-11 11:29:00 UTC (rev 5530)
@@ -491,18 +491,18 @@
 
       startLoader(false, null);
 
-      checkChildren(new Fqn<String>(), null);
+      checkChildren(Fqn.ROOT, null);
       checkChildren(Fqn.fromString("/key0"), null);
 
       loader.put(Fqn.fromString("/key0"), null);
-      checkChildren(new Fqn<String>(), new String[]{"key0"});
+      checkChildren(Fqn.ROOT, new String[]{"key0"});
 
       loader.put(Fqn.fromString("/key1/x"), null);
-      checkChildren(new Fqn<String>(), new String[]{"key0", "key1"});
+      checkChildren(Fqn.ROOT, new String[]{"key0", "key1"});
       checkChildren(Fqn.fromString("/key1"), new String[]{"x"});
 
       loader.remove(Fqn.fromString("/key1/x"));
-      checkChildren(new Fqn<String>(), new String[]{"key0", "key1"});
+      checkChildren(Fqn.ROOT, new String[]{"key0", "key1"});
       checkChildren(Fqn.fromString("/key0"), null);
       checkChildren(Fqn.fromString("/key1"), null);
 
@@ -533,7 +533,7 @@
                   "\u0000", "\u0001"});
 
       loader.put(Fqn.fromString("/\u0001"), null);
-      checkChildren(new Fqn<String>(), new String[]{"key0", "key1", "\u0001"});
+      checkChildren(Fqn.ROOT, new String[]{"key0", "key1", "\u0001"});
 
       loader.put(Fqn.fromString("/\u0001/\u0001"), null);
       checkChildren(Fqn.fromString("/\u0001"), new String[]{"\u0001"});

Modified: core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderTestsBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderTestsBase.java	2008-04-10 23:33:56 UTC (rev 5529)
+++ core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderTestsBase.java	2008-04-11 11:29:00 UTC (rev 5530)
@@ -1400,21 +1400,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);
 
@@ -1448,7 +1448,7 @@
       //                                   "\u0000", "\u0001"});
       //
       //      loader.put(Fqn.fromString("/\u0001"), null);
-      //      checkChildren(new Fqn(), new String[] { "key0", "key1", "\u0001" });
+      //      checkChildren(Fqn.ROOT, new String[] { "key0", "key1", "\u0001" });
       //
       //      loader.put(Fqn.fromString("/\u0001/\u0001"), null);
       //      checkChildren(Fqn.fromString("/\u0001"), new String[] { "\u0001" });

Modified: core/trunk/src/test/java/org/jboss/cache/loader/ClusteredCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/ClusteredCacheLoaderTest.java	2008-04-10 23:33:56 UTC (rev 5529)
+++ core/trunk/src/test/java/org/jboss/cache/loader/ClusteredCacheLoaderTest.java	2008-04-11 11:29:00 UTC (rev 5530)
@@ -158,9 +158,9 @@
    public void testGetChildrenNames() throws Exception
    {
       cache1.put(fqn, key, "value");
-      Fqn<String> child1 = new Fqn<String>(fqn, "child1");
-      Fqn<String> child2 = new Fqn<String>(fqn, "child2");
-      Fqn<String> child3 = new Fqn<String>(fqn, "child3");
+      Fqn child1 = Fqn.fromRelativeElements(fqn, "child1");
+      Fqn child2 = Fqn.fromRelativeElements(fqn, "child2");
+      Fqn child3 = Fqn.fromRelativeElements(fqn, "child3");
       cache1.put(child1, key, "value");
       cache1.put(child2, key, "value");
       cache1.put(child3, key, "value");

Modified: core/trunk/src/test/java/org/jboss/cache/marshall/ActiveInactiveTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/ActiveInactiveTest.java	2008-04-10 23:33:56 UTC (rev 5529)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/ActiveInactiveTest.java	2008-04-11 11:29:00 UTC (rev 5530)
@@ -13,8 +13,8 @@
 import org.jboss.cache.Region;
 import org.jboss.cache.RegionManager;
 import org.jboss.cache.commands.CommandsFactory;
+import org.jboss.cache.commands.cachedata.PutKeyValueCommand;
 import org.jboss.cache.commands.remote.ReplicateCommand;
-import org.jboss.cache.commands.cachedata.PutKeyValueCommand;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.misc.TestingUtil;
 import static org.testng.AssertJUnit.*;
@@ -39,7 +39,7 @@
    Configuration c;
    Fqn<String> A = Fqn.fromString("/a");
    Fqn<String> I = Fqn.fromString("/i");
-   Fqn<String> A_B = new Fqn<String>(A, "b");
+   Fqn A_B = Fqn.fromRelativeElements(A, "b");
 
    @BeforeMethod(alwaysRun = true)
    public void setUp() throws Exception

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:33:56 UTC (rev 5529)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshallerTestBase.java	2008-04-11 11:29:00 UTC (rev 5530)
@@ -235,7 +235,7 @@
       // replication queue takes a list of replicate() MethodCalls and wraps them in a single replicate call.
       List<MethodCall> calls = new ArrayList<MethodCall>();
 
-      Fqn f = new Fqn<Object>("BlahBlah", 3, false);
+      Fqn f = Fqn.fromElements("BlahBlah", 3, false);
       String k = "key", v = "value";
 
       MethodCall actualCall = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal_id, null, f, k, v, true);

Modified: core/trunk/src/test/java/org/jboss/cache/transaction/ReplicatedTransactionDeadlockTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/ReplicatedTransactionDeadlockTest.java	2008-04-10 23:33:56 UTC (rev 5529)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/ReplicatedTransactionDeadlockTest.java	2008-04-11 11:29:00 UTC (rev 5530)
@@ -5,7 +5,6 @@
 import org.jboss.cache.CacheFactory;
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
-import org.jboss.cache.Fqn;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.config.Configuration.CacheMode;
 import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
@@ -215,7 +214,7 @@
             log.warn("begin");
             tx.begin();
             log.warn("put");
-            srcCache.put(new Fqn<String>("Node"), Boolean.FALSE, Boolean.TRUE);
+            srcCache.put("/Node", Boolean.FALSE, Boolean.TRUE);
             log.warn("commit");
             tx.commit();
             log.warn("leave");

Modified: core/trunk/src/test/java/org/jboss/cache/transaction/TransactionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/TransactionTest.java	2008-04-10 23:33:56 UTC (rev 5529)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/TransactionTest.java	2008-04-11 11:29:00 UTC (rev 5530)
@@ -1022,7 +1022,7 @@
    public void testRootNodeRemoval() throws Exception
    {
       Fqn root = Fqn.ROOT;
-      Fqn<Integer> fqn = new Fqn<Integer>(1);
+      Fqn<Integer> fqn = Fqn.fromElements(1);
       //put first time
       tx.begin();
       this.cache.put(fqn, "k", "v");
@@ -1076,7 +1076,7 @@
    {
       @SuppressWarnings("unchecked")
       Fqn<Object> root = Fqn.ROOT;
-      Fqn<Object> fqn = new Fqn<Object>(root, 1);
+      Fqn<Object> fqn = Fqn.fromRelativeElements(root, 1);
       //put first time
       tx.begin();
       this.cache.put(fqn, "k", "v");




More information about the jbosscache-commits mailing list