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

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Wed Aug 15 05:07:02 EDT 2007


Author: manik.surtani at jboss.com
Date: 2007-08-15 05:07:02 -0400 (Wed, 15 Aug 2007)
New Revision: 4278

Modified:
   core/trunk/pom.xml
   core/trunk/src/test-perf/java/org/jboss/cache/manualtests/CacheMemoryLeakTest.java
   core/trunk/src/test-perf/java/org/jboss/cache/test/perf/Address.java
   core/trunk/src/test-perf/java/org/jboss/cache/test/perf/RandomString.java
   core/trunk/src/test-perf/java/org/jboss/cache/test/perf/Server.java
   core/trunk/src/test/java/org/jboss/cache/FqnTest.java
Log:
Fixed so tests compile + migrated one test to TestNG

Modified: core/trunk/pom.xml
===================================================================
--- core/trunk/pom.xml	2007-08-15 08:03:35 UTC (rev 4277)
+++ core/trunk/pom.xml	2007-08-15 09:07:02 UTC (rev 4278)
@@ -63,6 +63,14 @@
       <artifactId>jboss-aop-mc-int</artifactId>
       <version>2.0.0-SNAPSHOT</version>
     </dependency>
+
+	<!-- test dependencies -->
+	<dependency>
+  		<groupId>jmock</groupId>
+  		<artifactId>jmock</artifactId>
+  		<version>1.2.0</version>
+	</dependency>
+
   </dependencies>
   <build>
     <plugins>

Modified: core/trunk/src/test/java/org/jboss/cache/FqnTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/FqnTest.java	2007-08-15 08:03:35 UTC (rev 4277)
+++ core/trunk/src/test/java/org/jboss/cache/FqnTest.java	2007-08-15 09:07:02 UTC (rev 4278)
@@ -7,11 +7,11 @@
 package org.jboss.cache;
 
 
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
 import org.jboss.cache.config.Configuration;
 import org.jgroups.util.Util;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.Test;
 
 import java.util.HashMap;
 
@@ -21,15 +21,17 @@
  * @author <a href="mailto:bela at jboss.org">Bela Ban</a> May 9, 2003
  * @version $Revision$
  */
-public class FqnTest extends TestCase
+public class FqnTest
 {
    private Cache cache;
 
+   @BeforeTest
    protected void setUp()
    {
       cache = null;
    }
 
+   @AfterTest
    protected void tearDown()
    {
       if (cache != null)
@@ -39,84 +41,87 @@
       }
    }
 
-   public FqnTest(String s)
-   {
-      super(s);
-   }
-
+   @Test
    public void testNull()
    {
       Fqn fqn = new Fqn();
       log("null fqn is " + fqn);
-      assertEquals(0, fqn.size());
+      assert 0 == fqn.size();
       int hcode = fqn.hashCode();
-      assertTrue(hcode != -1);
+      assert hcode != -1;
    }
 
+   @Test
    public void testOne()
    {
       Fqn<Integer> fqn = new Fqn<Integer>(22);
       log("one fqn is " + fqn);
-      assertEquals(1, fqn.size());
+      assert 1 == fqn.size();
       int hcode = fqn.hashCode();
-      assertTrue(hcode != -1);
+      assert hcode != -1;
    }
 
+   @Test
    public void testEmptyFqn()
    {
       Fqn f1 = new Fqn();
       Fqn f2 = new Fqn();
-      assertEquals(f1, f2);
+      assert f1.equals(f2);
    }
 
+   @Test
    public void testFqn()
    {
       Fqn<String> fqn = Fqn.fromString("/a/b/c");
       log("fqn is " + fqn);
-      assertEquals(3, fqn.size());
+      assert 3 == fqn.size();
 
       Fqn<String> fqn2 = new Fqn<String>("a", "b", "c");
       log("fqn2 is " + fqn2);
-      assertEquals(3, fqn2.size());
-      assertEquals("fqn should equal fqn2", fqn, fqn2);
-      assertEquals(fqn.hashCode(), fqn2.hashCode());
+      assert 3 == fqn.size();
+      assert fqn.equals(fqn2);
+      assert fqn.hashCode() == fqn2.hashCode();
    }
 
+   @Test
    public void testHereogeneousNames()
    {
       Fqn<Object> fqn = new Fqn<Object>("string", 38, true);
       log("fqn is " + fqn);
-      assertEquals(3, fqn.size());
+      assert 3 == fqn.size();
 
       Fqn<Object> fqn2 = new Fqn<Object>("string", 38, true);
-      assertEquals(fqn, fqn2);
-      assertEquals(fqn.hashCode(), fqn2.hashCode());
+      assert fqn.equals(fqn2);
+      assert fqn.hashCode() == fqn2.hashCode();
    }
 
+   @Test
    public void testHashcode()
    {
       Fqn fqn1, fqn2;
       fqn1 = new Fqn<Object>("a", "b", "c");
       fqn2 = Fqn.fromString("/a/b/c");
       log("fqn is " + fqn1);
-      assertEquals(fqn1, fqn2);
+      assert fqn1.equals(fqn2);
 
       HashMap<Fqn, Integer> map = new HashMap<Fqn, Integer>();
       map.put(fqn1, 33);
       map.put(fqn2, 34);
-      assertEquals(1, map.size());
-      assertEquals(new Integer(34), map.get(fqn1));
+      assert map.size() == 1;
+      assert map.get(fqn1).equals(34);
    }
 
+   @Test
    public void testHashcode2()
    {
       Fqn<Integer> fqn = new Fqn<Integer>(-1);
       log("one fqn is " + fqn);
-      assertEquals(1, fqn.size());
+      assert fqn.size() == 1;
       int hcode = fqn.hashCode();
-      assertTrue(hcode == -1);
+      assert hcode == -1;
    }
 
+   @Test
    public void testEquals()
    {
       Fqn<String> fqn1 = new Fqn<String>("person/test");
@@ -134,197 +139,211 @@
       map.put(f2, "1");
       map.put(f3, "2");
 
-      assertNotNull("f1 ", map.get(new Fqn<String>(fqn1, "0")));
-      assertNotNull("f2 ", map.get(new Fqn<String>(fqn1, "1")));
-      assertNotNull("f3 ", map.get(new Fqn<String>(fqn1, "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;
 
    }
 
-
+   @Test
    public void testEquals2()
    {
       Fqn<String> f1;
       Fqn<String> f2;
       f1 = Fqn.fromString("/a/b/c");
       f2 = Fqn.fromString("/a/b/c");
-      assertEquals(f1, f2);
+      assert f1.equals(f2);
 
       f2 = Fqn.fromString("/a/b");
-      assertFalse(f1.equals(f2));
+      assert !f1.equals(f2);
 
       f2 = Fqn.fromString("/a/b/c/d");
-      assertFalse(f1.equals(f2));
+      assert !f1.equals(f2);
    }
 
+   @Test
    public void testEquals2WithMarshalling() throws Exception
    {
       Fqn<String> f1, f2;
       f1 = Fqn.fromString("/a/b/c");
       f2 = marshalAndUnmarshal(f1);
-      assertEquals(f1, f2);
+      assert f1.equals(f2);
    }
 
-
+   @Test
    public void testEquals3()
    {
       Fqn<Object> f1;
       Fqn<? extends Object> f2;
       f1 = new Fqn<Object>("a", 322649, Boolean.TRUE);
       f2 = new Fqn<String>();
-      assertFalse(f1.equals(f2));
-      assertFalse(f2.equals(f1));
+      assert !f1.equals(f2);
+      assert !f2.equals(f1);
 
       f2 = Fqn.fromString("a/322649/TRUE");
-      assertFalse(f1.equals(f2));
+      assert !f1.equals(f2);
 
       f2 = new Fqn<Object>("a", 322649, Boolean.FALSE);
-      assertFalse(f1.equals(f2));
+      assert !f1.equals(f2);
 
       f2 = new Fqn<Object>("a", 322649, Boolean.TRUE);
-      assertEquals(f1, f2);
+      assert f1.equals(f2);
    }
 
+   @Test
    public void testEquals3WithMarshalling() throws Exception
    {
       Fqn f1, f2;
       f1 = new Fqn<Object>("a", 322649, Boolean.TRUE);
       f2 = marshalAndUnmarshal(f1);
-      assertEquals(f1, f2);
-      assertEquals(f2, f1);
+      assert f1.equals(f2);
+      assert f2.equals(f1);
 
       f2 = Fqn.fromString("a/322649/TRUE");
       f2 = marshalAndUnmarshal(f2);
-      assertFalse(f1.equals(f2));
+      assert !f1.equals(f2);
 
       f2 = new Fqn<Object>("a", 322649, Boolean.FALSE);
       f2 = marshalAndUnmarshal(f2);
-      assertFalse(f1.equals(f2));
+      assert !f1.equals(f2);
 
       f2 = new Fqn<Object>("a", 322649, Boolean.TRUE);
       f2 = marshalAndUnmarshal(f2);
-      assertEquals(f1, f2);
+      assert f1.equals(f2);
    }
 
+   @Test
    public void testEquals4()
    {
       Fqn<String> fqn = Fqn.fromString("X");
       // Check casting
-      assertFalse("Casting ok", fqn.equals("X"));
+      assert !fqn.equals("X");
       // Check null
-      assertFalse("null ok", fqn.equals(null));
+      assert !fqn.equals(null);
    }
 
+   @Test
    public void testClone() throws CloneNotSupportedException
    {
       Fqn<String> fqn1 = Fqn.fromString("/a/b/c");
       Fqn<String> fqn2 = fqn1.clone();
-      assertEquals(fqn1, fqn2);
-      assertEquals(fqn1.hashCode(), fqn2.hashCode());
+      assert fqn1.equals(fqn2);
+      assert fqn1.hashCode() == fqn2.hashCode();
    }
 
+   @Test
    public void testNullElements() throws CloneNotSupportedException
    {
       Fqn<Object> fqn0 = new Fqn<Object>((Object) null);
-      assertEquals(1, fqn0.size());
+      assert 1 == fqn0.size();
 
       Fqn<Object> fqn1 = new Fqn<Object>("NULL", null, 0);
-      assertEquals(3, fqn1.size());
+      assert 3 == fqn1.size();
 
       Fqn<Object> fqn2 = new Fqn<Object>("NULL", null, 0);
-      assertEquals(fqn1.hashCode(), fqn2.hashCode());
-      assertEquals(fqn1, fqn2);
-      assertEquals(fqn1, fqn1.clone());
+      assert fqn1.hashCode() == fqn2.hashCode();
+      assert fqn1.equals(fqn2);
+      assert fqn1.equals(fqn1.clone());
    }
 
+   @Test
    public void testIteration()
    {
       Fqn<String> fqn = Fqn.fromString("/a/b/c");
-      assertEquals(3, fqn.size());
+      assert 3 == fqn.size();
       Fqn<Object> tmp_fqn = new Fqn<Object>();
-      assertEquals(0, tmp_fqn.size());
+      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);
-         assertEquals(tmp_fqn.size(), i + 1);
+         assert tmp_fqn.size() == i + 1;
       }
-      assertEquals(3, tmp_fqn.size());
-      assertEquals(fqn, tmp_fqn);
+      assert 3 == tmp_fqn.size();
+      assert fqn.equals(tmp_fqn);
    }
 
+   @Test
    public void testIsChildOf()
    {
       Fqn<String> child = Fqn.fromString("/a/b");
       Fqn<String> parent = Fqn.fromString("/a");
-      assertTrue("Is child of ", child.isChildOf(parent));
-      assertFalse("Is child of ", parent.isChildOf(child));
-      assertTrue("Is same ", child.isChildOrEquals(child));
+      assert child.isChildOf(parent);
+      assert !parent.isChildOf(child);
+      assert child.isChildOrEquals(child);
 
       parent = Fqn.fromString("/a/b/c");
       child = Fqn.fromString("/a/b/c/d/e/f/g/h/e/r/e/r/t/tt/");
-      assertTrue(child.isChildOf(parent));
+      assert child.isChildOf(parent);
    }
 
+   @Test
    public void testIsChildOf2()
    {
       Fqn<String> child = Fqn.fromString("/a/b/c/d");
-      assertEquals("Fqn ", "/b/c/d", child.getSubFqn(1, child.size()).toString());
+      assert "/b/c/d".equals(child.getSubFqn(1, child.size()).toString());
    }
 
+   @Test
    public void testParentage()
    {
       Fqn<String> fqnRoot = new Fqn<String>();
       Fqn<String> parent = fqnRoot.getParent();
-      assertEquals(parent, fqnRoot);
+      assert parent.equals(fqnRoot);
 
       Fqn<String> fqnOne = Fqn.fromString("/one");
       parent = fqnOne.getParent();
-      assertEquals(parent, fqnRoot);
-      assertTrue(fqnOne.isChildOf(parent));
+      assert parent.equals(fqnRoot);
+      assert fqnOne.isChildOf(parent);
 
       Fqn<String> fqnTwo = Fqn.fromString("/one/two");
       parent = fqnTwo.getParent();
-      assertEquals(parent, fqnOne);
-      assertTrue(fqnTwo.isChildOf(parent));
+      assert parent.equals(fqnOne);
+      assert fqnTwo.isChildOf(parent);
 
       Fqn<String> fqnThree = Fqn.fromString("/one/two/three");
       parent = fqnThree.getParent();
-      assertEquals(parent, fqnTwo);
-      assertTrue(fqnThree.isChildOf(parent));
+      assert parent.equals(fqnTwo);
+      assert fqnThree.isChildOf(parent);
 
    }
 
+   @Test
    public void testRoot()
    {
       Fqn<String> fqn = new Fqn<String>();
-      assertTrue(fqn.isRoot());
+      assert fqn.isRoot();
 
       fqn = Fqn.fromString("/one/two");
-      assertFalse(fqn.isRoot());
+      assert !fqn.isRoot();
    }
 
+   @Test
    public void testGetName()
    {
       Fqn<Integer> integerFqn = new Fqn<Integer>(1);
-      assertEquals("1", integerFqn.getLastElementAsString());
+      assert "1".equals(integerFqn.getLastElementAsString());
 
       Object object = new Object();
       Fqn<Object> objectFqn = new Fqn<Object>(object);
-      assertEquals(object.toString(), objectFqn.getLastElementAsString());
+      assert object.toString().equals(objectFqn.getLastElementAsString());
    }
 
+   @Test
    public void testCloningString() throws CloneNotSupportedException
    {
       Fqn<String> f = Fqn.fromString("/a/b/c");
-      assertEquals(f, f.clone());
+      assert f.equals(f.clone());
    }
 
+   @Test
    public void testCloningOtherTypes() throws CloneNotSupportedException
    {
       Fqn<Object> f = new Fqn<Object>("blah", 10, Boolean.TRUE);
-      assertEquals(f, f.clone());
+      assert f.equals(f.clone());
    }
 
+   @Test
    public void testRemovalNonString() throws Exception
    {
       Fqn<Object> f = new Fqn<Object>("test", 1);
@@ -335,13 +354,13 @@
 
       cache.put(f, "key", "value");
 
-      assertEquals("value", cache.get(f, "key"));
-      assertTrue(cache.getRoot().hasChild(f));
+      assert "value".equals(cache.get(f, "key"));
+      assert cache.getRoot().hasChild(f);
 
       cache.removeNode(f);
 
-      assertNull(cache.get(f, "key"));
-      assertFalse(cache.getRoot().hasChild(f));
+      assert cache.get(f, "key") == null;
+      assert !cache.getRoot().hasChild(f);
    }
 
    Fqn marshalAndUnmarshal(Fqn fqn) throws Exception
@@ -352,51 +371,55 @@
 
    // testing generics
 
+   @Test
    public void testGenerics()
    {
       Fqn<String> f = Fqn.fromString("/blah/blah");
       Fqn<String> f2 = Fqn.fromString("/blah/blah");
 
-      assertEquals(f, f2);
+      assert f.equals(f2);
 
       Fqn<Integer> f3 = new Fqn<Integer>(1, 2, 3, 5);
 
       Fqn<Integer> f4 = new Fqn<Integer>(1, 2, 3);
 
-      assertEquals(f3.getParent(), f4);
+      assert f3.getParent().equals(f4);
    }
 
+   @Test
    public void testGenerations()
    {
       Fqn<Integer> f = new Fqn<Integer>(1, 2, 3, 4, 5, 6, 7);
 
-      assertEquals(f, f.getAncestor(f.size()));
-      assertEquals(f.getParent(), f.getAncestor(f.size() - 1));
-      assertEquals(Fqn.ROOT, f.getAncestor(0));
-      assertEquals(new Fqn<Integer>(1), f.getAncestor(1));
-      assertEquals(new Fqn<Integer>(1, 2), f.getAncestor(2));
-      assertEquals(new Fqn<Integer>(1, 2, 3), f.getAncestor(3));
-      assertEquals(new Fqn<Integer>(1, 2, 3, 4), f.getAncestor(4));
-      assertEquals(new Fqn<Integer>(1, 2, 3, 4, 5), f.getAncestor(5));
+      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));
 
       try
       {
          f.getAncestor(-1);
-         fail("Should fail");
+         // should fail
+         assert false;
       }
-      catch (Exception e)
+      catch (IllegalArgumentException good)
       {
-         e.printStackTrace();
+         // expected
       }
 
       try
       {
          f.getAncestor(f.size() + 1);
-         fail("Should fail");
+         // should fail
+         assert false;
       }
-      catch (Exception e)
+      catch (IndexOutOfBoundsException good)
       {
-         e.printStackTrace();
+         // expected
       }
    }
 
@@ -404,14 +427,4 @@
    {
       System.out.println("-- " + msg);
    }
-
-   public static Test suite()
-   {
-      return new TestSuite(FqnTest.class);
-   }
-
-   public static void main(String[] args)
-   {
-      junit.textui.TestRunner.run(suite());
-   }
 }

Modified: core/trunk/src/test-perf/java/org/jboss/cache/manualtests/CacheMemoryLeakTest.java
===================================================================
--- core/trunk/src/test-perf/java/org/jboss/cache/manualtests/CacheMemoryLeakTest.java	2007-08-15 08:03:35 UTC (rev 4277)
+++ core/trunk/src/test-perf/java/org/jboss/cache/manualtests/CacheMemoryLeakTest.java	2007-08-15 09:07:02 UTC (rev 4278)
@@ -5,7 +5,7 @@
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.config.Configuration;
-import org.jboss.cache.pojo.test.Person;
+//import org.jboss.cache.pojo.test.Person;
 
 public class CacheMemoryLeakTest extends TestCase
 {
@@ -21,10 +21,10 @@
       {
          for (int i = 0; i < 100; i++)
          {
-            Person person = new Person();
-            person.setName("aaa");
-            cache.put(Fqn.fromString(category + "/testPerson" + i), "key", person);
-            assertEquals(person, cache.get(Fqn.fromString(category + "/testPerson" + i), "key"));
+//            Person person = new Person();
+//            person.setName("aaa");
+//            cache.put(Fqn.fromString(category + "/testPerson" + i), "key", person);
+//            assertEquals(person, cache.get(Fqn.fromString(category + "/testPerson" + i), "key"));
          }
          // delete from the cache.
          cache.getRoot().removeChild(Fqn.fromString(category));

Modified: core/trunk/src/test-perf/java/org/jboss/cache/test/perf/Address.java
===================================================================
--- core/trunk/src/test-perf/java/org/jboss/cache/test/perf/Address.java	2007-08-15 08:03:35 UTC (rev 4277)
+++ core/trunk/src/test-perf/java/org/jboss/cache/test/perf/Address.java	2007-08-15 09:07:02 UTC (rev 4278)
@@ -1,11 +1,11 @@
 package org.jboss.cache.test.perf;
 
-import org.jboss.cache.pojo.annotation.Replicable;
+//import org.jboss.cache.pojo.annotation.Replicable;
 
 /**
  * @author Ben Wang
  */
- at Replicable
+//@Replicable
 public class Address implements java.io.Serializable {
    protected String city;
    protected int zip;

Modified: core/trunk/src/test-perf/java/org/jboss/cache/test/perf/RandomString.java
===================================================================
--- core/trunk/src/test-perf/java/org/jboss/cache/test/perf/RandomString.java	2007-08-15 08:03:35 UTC (rev 4277)
+++ core/trunk/src/test-perf/java/org/jboss/cache/test/perf/RandomString.java	2007-08-15 09:07:02 UTC (rev 4278)
@@ -1,10 +1,10 @@
 package org.jboss.cache.test.perf;
 
-import org.jboss.cache.pojo.annotation.Replicable;
+//import org.jboss.cache.pojo.annotation.Replicable;
 
 import java.util.Random;
 
- at Replicable
+//@Replicable
 public class RandomString
 {
 

Modified: core/trunk/src/test-perf/java/org/jboss/cache/test/perf/Server.java
===================================================================
--- core/trunk/src/test-perf/java/org/jboss/cache/test/perf/Server.java	2007-08-15 08:03:35 UTC (rev 4277)
+++ core/trunk/src/test-perf/java/org/jboss/cache/test/perf/Server.java	2007-08-15 09:07:02 UTC (rev 4278)
@@ -13,13 +13,15 @@
 import org.jboss.cache.CacheException;
 import org.jboss.cache.CacheImpl;
 import org.jboss.cache.Fqn;
+import org.jboss.cache.Cache;
+import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.factories.XmlConfigurationParser;
 import org.jboss.cache.notifications.annotation.CacheListener;
 import org.jboss.cache.notifications.annotation.ViewChanged;
 import org.jboss.cache.notifications.event.ViewChangedEvent;
-import org.jboss.cache.pojo.PojoCache;
-import org.jboss.cache.pojo.PojoCacheFactory;
+//import org.jboss.cache.pojo.PojoCache;
+//import org.jboss.cache.pojo.PojoCacheFactory;
 import org.jboss.cache.transaction.DummyTransactionManager;
 
 import javax.transaction.SystemException;
@@ -40,7 +42,8 @@
  */
 public class Server
 {
-   static PojoCache pojoCache;
+//   static PojoCache pojoCache;
+   static CacheImpl pojoCache;
    static CacheImpl<Object, Object> plainCache;
    Properties props_ = new Properties();
    static int threads_;  // how many threads to send the put.
@@ -73,8 +76,8 @@
       XmlConfigurationParser parser = new XmlConfigurationParser();
       Configuration config = parser.parseFile(file);
       config.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
-      pojoCache = PojoCacheFactory.createCache(config, false);
-      plainCache = (CacheImpl) pojoCache.getCache();
+      pojoCache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(config, false);
+      plainCache = pojoCache;
    }
 
    void destroyCache() throws Exception
@@ -83,7 +86,7 @@
       pojoCache = null;
    }
 
-   PojoCache getCache()
+   Cache getCache()
    {
       return pojoCache;
    }
@@ -175,7 +178,7 @@
       {
          // This is to pre-load the POJO class definition
          Object pojo = Loader.constructObject();
-         pojoCache.attach(ROOT + plainCache.getLocalAddress().toString() + "/test", pojo);
+         //pojoCache.attach(ROOT + plainCache.getLocalAddress().toString() + "/test", pojo);
       }
 
       startTime_ = System.currentTimeMillis();
@@ -284,7 +287,7 @@
 
       server.initCache();
       ViewListener listener = new ViewListener(addrList);
-      pojoCache.getCache().addCacheListener(listener); // register for view change
+      pojoCache.addCacheListener(listener); // register for view change
       pojoCache.start();
       System.out.println("Cache started .. ");
 
@@ -296,7 +299,7 @@
 
       // Let's remove the tree cache listener since we are done. This is needed so we don't cloud
       // the perf number.
-      pojoCache.getCache().removeCacheListener(listener);
+      pojoCache.removeCacheListener(listener);
 
       sleep_(2000);
 
@@ -366,11 +369,11 @@
    {
       int threadId;
       String localAddress;
-      PojoCache cache_;
+      Cache cache_;
 
       TransactionManager tm_ = DummyTransactionManager.getInstance();
 
-      public Loader(PojoCache cache, int i, String localAddress)
+      public Loader(Cache cache, int i, String localAddress)
       {
          cache_ = cache;
          threadId = i;
@@ -520,30 +523,30 @@
       {
          if (operationType_ == 1)
          {
-            cache_.attach(fqn, pojo);
-            Object obj = cache_.find(fqn);
-            if (!((Student) obj).getName().equals("Joe"))
-            {
-               throw new RuntimeException("Value returned not Joe");
-            }
+//            cache_.attach(fqn, pojo);
+//            Object obj = cache_.find(fqn);
+//            if (!((Student) obj).getName().equals("Joe"))
+//            {
+//               throw new RuntimeException("Value returned not Joe");
+//            }
          }
          else
          {
-            cache_.detach(fqn);
-            cache_.attach(fqn, pojo);
-            Object obj = cache_.find(fqn);
-            if (!((Student) obj).getName().equals("Joe"))
-            {
-               throw new RuntimeException("Value returned not Joe");
-            }
+//            cache_.detach(fqn);
+//            cache_.attach(fqn, pojo);
+//            Object obj = cache_.find(fqn);
+//            if (!((Student) obj).getName().equals("Joe"))
+//            {
+//               throw new RuntimeException("Value returned not Joe");
+//            }
          }
       }
 
       void doPojoCacheFieldWork(String fqn, Object pojo) throws CacheException
       {
-         Object obj = cache_.find(fqn);
-         List list = (List) ((Student) obj).getCourses();
-         ((Course) list.get(0)).setInstructor("Ben Wang");
+//         Object obj = cache_.find(fqn);
+//         List list = (List) ((Student) obj).getCourses();
+//         ((Course) list.get(0)).setInstructor("Ben Wang");
 //         ((Student)obj).setSchool("Pingtung");
       }
 




More information about the jbosscache-commits mailing list