[jboss-cvs] JBossCache/tests/functional/org/jboss/cache ...

Manik Surtani msurtani at jboss.com
Wed Sep 6 11:31:01 EDT 2006


  User: msurtani
  Date: 06/09/06 11:31:01

  Modified:    tests/functional/org/jboss/cache        CallbackTest.java
                        FqnTest.java GetKeysTest.java
                        InterceptorConfigurationTest.java
                        LifeCycleTest.java TreeCacheFunctionalTest.java
                        TreeNodeTest.java
  Log:
  Removed TreeCache dependency on ServiceMBeanSupport
  
  Revision  Changes    Path
  1.13      +5 -5      JBossCache/tests/functional/org/jboss/cache/CallbackTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CallbackTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/CallbackTest.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -b -r1.12 -r1.13
  --- CallbackTest.java	30 Aug 2006 19:09:57 -0000	1.12
  +++ CallbackTest.java	6 Sep 2006 15:31:01 -0000	1.13
  @@ -14,7 +14,7 @@
    * Tests whether modifications within callbacks (TreeCacheListener) are handled correctly
    *
    * @author Bela Ban
  - * @version $Id: CallbackTest.java,v 1.12 2006/08/30 19:09:57 msurtani Exp $
  + * @version $Id: CallbackTest.java,v 1.13 2006/09/06 15:31:01 msurtani Exp $
    */
   public class CallbackTest extends TestCase
   {
  @@ -36,8 +36,8 @@
         super.tearDown();
         if (cache != null)
         {
  -         cache.stopService();
  -         cache.destroyService();
  +         cache.stop();
  +         cache.destroy();
            cache = null;
         }
         if (tx != null)
  @@ -170,8 +170,8 @@
         c.getConfiguration().setCacheMode(mode);
         c.getConfiguration().setIsolationLevel(level);
         c.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
  -      c.createService();
  -      c.startService();
  +      c.create();
  +      c.start();
         return c;
      }
   
  
  
  
  1.14      +146 -121  JBossCache/tests/functional/org/jboss/cache/FqnTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: FqnTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/FqnTest.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -b -r1.13 -r1.14
  --- FqnTest.java	22 Aug 2006 13:43:08 -0000	1.13
  +++ FqnTest.java	6 Sep 2006 15:31:01 -0000	1.14
  @@ -10,90 +10,101 @@
   import junit.framework.Test;
   import junit.framework.TestCase;
   import junit.framework.TestSuite;
  -import org.jgroups.util.Util;
   import org.jboss.cache.config.Configuration;
   import org.jboss.cache.factories.DefaultCacheFactory;
  +import org.jgroups.util.Util;
   
   import java.util.HashMap;
   
   /**
    * Tests {@link Fqn}.
  + *
    * @author <a href="mailto:bela at jboss.org">Bela Ban</a> May 9, 2003
  - * @version $Revision: 1.13 $
  + * @version $Revision: 1.14 $
    */
  -public class FqnTest extends TestCase {
  +public class FqnTest extends TestCase
  +{
   
  -   public FqnTest(String s) {
  +   public FqnTest(String s)
  +   {
         super(s);
      }
   
  -   public void testNull() {
  -      Fqn fqn=new Fqn();
  +   public void testNull()
  +   {
  +      Fqn fqn = new Fqn();
         log("null fqn is " + fqn);
         assertEquals(0, fqn.size());
  -      int hcode=fqn.hashCode();
  +      int hcode = fqn.hashCode();
         assertTrue(hcode != -1);
      }
   
  -   public void testOne() {
  -      Fqn fqn=new Fqn(new Integer(22));
  +   public void testOne()
  +   {
  +      Fqn fqn = new Fqn(new Integer(22));
         log("one fqn is " + fqn);
         assertEquals(1, fqn.size());
  -      int hcode=fqn.hashCode();
  +      int hcode = fqn.hashCode();
         assertTrue(hcode != -1);
      }
   
  -   public void testEmptyFqn() {
  -      Fqn f1=new Fqn();
  -      Fqn f2=new Fqn();
  +   public void testEmptyFqn()
  +   {
  +      Fqn f1 = new Fqn();
  +      Fqn f2 = new Fqn();
         assertEquals(f1, f2);
      }
   
  -   public void testFqn() {
  -      Fqn fqn=Fqn.fromString("/a/b/c");
  +   public void testFqn()
  +   {
  +      Fqn fqn = Fqn.fromString("/a/b/c");
         log("fqn is " + fqn);
         assertEquals(3, fqn.size());
   
  -      Fqn fqn2=new Fqn(new Object[]{"a", "b", "c"});
  +      Fqn fqn2 = new Fqn(new Object[]{"a", "b", "c"});
         log("fqn2 is " + fqn2);
         assertEquals(3, fqn2.size());
         assertEquals("fqn should equal fqn2", fqn, fqn2);
         assertEquals(fqn.hashCode(), fqn2.hashCode());
      }
   
  -   public void testHereogeneousNames() {
  -      Fqn fqn=new Fqn(new Object[]{"string", new Integer(38), new Boolean(true)});
  +   public void testHereogeneousNames()
  +   {
  +      Fqn fqn = new Fqn(new Object[]{"string", new Integer(38), new Boolean(true)});
         log("fqn is " + fqn);
         assertEquals(3, fqn.size());
   
  -      Fqn fqn2=new Fqn(new Object[]{"string", new Integer(38), new Boolean(true)});
  +      Fqn fqn2 = new Fqn(new Object[]{"string", new Integer(38), new Boolean(true)});
         assertEquals(fqn, fqn2);
         assertEquals(fqn.hashCode(), fqn2.hashCode());
      }
   
  -   public void testHashcode() {
  +   public void testHashcode()
  +   {
         Fqn fqn1, fqn2;
  -      fqn1=new Fqn(new Object[]{"a", "b", "c"});
  -      fqn2=Fqn.fromString("/a/b/c");
  +      fqn1 = new Fqn(new Object[]{"a", "b", "c"});
  +      fqn2 = Fqn.fromString("/a/b/c");
         log("fqn is " + fqn1);
         assertEquals(fqn1, fqn2);
   
  -      HashMap map=new HashMap();
  +      HashMap map = new HashMap();
         map.put(fqn1, new Integer(33));
         map.put(fqn2, new Integer(34));
         assertEquals(1, map.size());
         assertEquals(new Integer(34), map.get(fqn1));
      }
   
  -   public void testHashcode2() {
  -      Fqn fqn=new Fqn(new Integer(-1));
  +   public void testHashcode2()
  +   {
  +      Fqn fqn = new Fqn(new Integer(-1));
         log("one fqn is " + fqn);
         assertEquals(1, fqn.size());
  -      int hcode=fqn.hashCode();
  +      int hcode = fqn.hashCode();
         assertTrue(hcode == -1);
      }
   
  -   public void testEquals() {
  +   public void testEquals()
  +   {
         Fqn fqn1 = new Fqn("person/test");
   
         Fqn f1, f2, f3;
  @@ -114,61 +125,65 @@
      }
   
   
  -   public void testEquals2() {
  +   public void testEquals2()
  +   {
         Fqn f1, f2;
  -      f1=Fqn.fromString("/a/b/c");
  -      f2=Fqn.fromString("/a/b/c");
  +      f1 = Fqn.fromString("/a/b/c");
  +      f2 = Fqn.fromString("/a/b/c");
         assertEquals(f1, f2);
   
  -      f2=Fqn.fromString("/a/b");
  +      f2 = Fqn.fromString("/a/b");
         assertFalse(f1.equals(f2));
   
  -      f2=Fqn.fromString("/a/b/c/d");
  +      f2 = Fqn.fromString("/a/b/c/d");
         assertFalse(f1.equals(f2));
      }
   
  -   public void testEquals2WithMarshalling() throws Exception {
  +   public void testEquals2WithMarshalling() throws Exception
  +   {
         Fqn f1, f2;
  -      f1=Fqn.fromString("/a/b/c");
  -      f2=marshalAndUnmarshal(f1);
  +      f1 = Fqn.fromString("/a/b/c");
  +      f2 = marshalAndUnmarshal(f1);
         assertEquals(f1, f2);
      }
   
   
  -   public void testEquals3() {
  +   public void testEquals3()
  +   {
         Fqn f1, f2;
  -      f1=new Fqn(new Object[]{"a", new Integer(322649), Boolean.TRUE});
  -      f2=new Fqn();
  +      f1 = new Fqn(new Object[]{"a", new Integer(322649), Boolean.TRUE});
  +      f2 = new Fqn();
         assertFalse(f1.equals(f2));
         assertFalse(f2.equals(f1));
   
  -      f2=Fqn.fromString("a/322649/TRUE");
  +      f2 = Fqn.fromString("a/322649/TRUE");
         assertFalse(f1.equals(f2));
   
  -      f2=new Fqn(new Object[]{"a", new Integer(322649), Boolean.FALSE});
  +      f2 = new Fqn(new Object[]{"a", new Integer(322649), Boolean.FALSE});
         assertFalse(f1.equals(f2));
   
  -      f2=new Fqn(new Object[]{"a", new Integer(322649), Boolean.TRUE});
  +      f2 = new Fqn(new Object[]{"a", new Integer(322649), Boolean.TRUE});
         assertEquals(f1, f2);
      }
   
  -   public void testEquals3WithMarshalling() throws Exception {
  +   public void testEquals3WithMarshalling() throws Exception
  +   {
         Fqn f1, f2;
  -      f1=new Fqn(new Object[]{"a", new Integer(322649), Boolean.TRUE});
  -      f2=marshalAndUnmarshal(f1);
  +      f1 = new Fqn(new Object[]{"a", new Integer(322649), Boolean.TRUE});
  +      f2 = marshalAndUnmarshal(f1);
         assertEquals(f1, f2);
         assertEquals(f2, f1);
   
  -      f2=Fqn.fromString("a/322649/TRUE");
  -      f2=marshalAndUnmarshal(f2);
  +      f2 = Fqn.fromString("a/322649/TRUE");
  +      f2 = marshalAndUnmarshal(f2);
         assertFalse(f1.equals(f2));
   
  -      f2=new Fqn(new Object[]{"a", new Integer(322649), Boolean.FALSE});
  -      f2=marshalAndUnmarshal(f2);
  +      f2 = new Fqn(new Object[]{"a", new Integer(322649), Boolean.FALSE});
  +      f2 = marshalAndUnmarshal(f2);
         assertFalse(f1.equals(f2));
   
  -      f2=new Fqn(new Object[]{"a", new Integer(322649), Boolean.TRUE});
  -      f2=marshalAndUnmarshal(f2);
  +      f2 = new Fqn(new Object[]{"a", new Integer(322649), Boolean.TRUE});
  +      f2 = marshalAndUnmarshal(f2);
         assertEquals(f1, f2);
      }
      
  @@ -181,54 +196,60 @@
         assertFalse("null ok", fqn.equals(null));
      }
   
  -   public void testClone() throws CloneNotSupportedException {
  -      Fqn fqn1=Fqn.fromString("/a/b/c");
  -      Fqn fqn2=(Fqn)fqn1.clone();
  +   public void testClone() throws CloneNotSupportedException
  +   {
  +      Fqn fqn1 = Fqn.fromString("/a/b/c");
  +      Fqn fqn2 = (Fqn) fqn1.clone();
         assertEquals(fqn1, fqn2);
         assertEquals(fqn1.hashCode(), fqn2.hashCode());
      }
   
  -   public void testNullElements() throws CloneNotSupportedException {
  -      Fqn fqn0=new Fqn((Object)null);
  +   public void testNullElements() throws CloneNotSupportedException
  +   {
  +      Fqn fqn0 = new Fqn((Object) null);
         assertEquals(1, fqn0.size());
   
  -      Fqn fqn1=new Fqn(new Object[]{"NULL", null, new Integer(0)});
  +      Fqn fqn1 = new Fqn(new Object[]{"NULL", null, new Integer(0)});
         assertEquals(3, fqn1.size());
   
  -      Fqn fqn2=new Fqn(new Object[]{"NULL", null, new Integer(0), });
  +      Fqn fqn2 = new Fqn(new Object[]{"NULL", null, new Integer(0),});
         assertEquals(fqn1.hashCode(), fqn2.hashCode());
         assertEquals(fqn1, fqn2);
         assertEquals(fqn1, fqn1.clone());
      }
   
  -   public void testIteration() {
  -      Fqn fqn=Fqn.fromString("/a/b/c");
  +   public void testIteration()
  +   {
  +      Fqn fqn = Fqn.fromString("/a/b/c");
         assertEquals(3, fqn.size());
  -      Fqn tmp_fqn=new Fqn();
  +      Fqn tmp_fqn = new Fqn();
         assertEquals(0, tmp_fqn.size());
  -      for(int i=0; i < fqn.size(); i++) {
  -         Object obj=fqn.get(i);
  -         tmp_fqn=new Fqn(tmp_fqn, obj);
  -         assertEquals(tmp_fqn.size(), i+1);
  +      for (int i = 0; i < fqn.size(); i++)
  +      {
  +         Object obj = fqn.get(i);
  +         tmp_fqn = new Fqn(tmp_fqn, obj);
  +         assertEquals(tmp_fqn.size(), i + 1);
         }
         assertEquals(3, tmp_fqn.size());
         assertEquals(fqn, tmp_fqn);
      }
   
  -   public void testIsChildOf() {
  -      Fqn child=Fqn.fromString("/a/b");
  -      Fqn parent=Fqn.fromString("/a");
  +   public void testIsChildOf()
  +   {
  +      Fqn child = Fqn.fromString("/a/b");
  +      Fqn parent = Fqn.fromString("/a");
         assertTrue("Is child of ", child.isChildOf(parent));
         assertFalse("Is child of ", parent.isChildOf(child));
         assertTrue("Is same ", 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/");
  +      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));
      }
   
  -   public void testIsChildOf2() {
  -      Fqn child=Fqn.fromString("/a/b/c/d");
  +   public void testIsChildOf2()
  +   {
  +      Fqn child = Fqn.fromString("/a/b/c/d");
         assertEquals("Fqn ", "/b/c/d", child.getFqnChild(1, child.size()).toString());
      }
   
  @@ -288,10 +309,10 @@
   
      public void testRemovalNonString() throws Exception
      {
  -       Fqn f = new Fqn(new Object[] {"test", new Integer(1)});
  +      Fqn f = new Fqn(new Object[]{"test", new Integer(1)});
   //       TreeCache tc = new TreeCache();
   //       tc.getConfiguration().setCacheMode("LOCAL");
  -//       tc.startService();
  +//       tc.start();
          Configuration c = new Configuration();
          c.setCacheMode("LOCAL");
          Cache cache = new DefaultCacheFactory().createCache(c);
  @@ -308,21 +329,25 @@
      }
   
   
  -   Fqn marshalAndUnmarshal(Fqn fqn) throws Exception {
  -      byte[] buf=Util.objectToByteBuffer(fqn);
  -      Fqn newFqn=(Fqn)Util.objectFromByteBuffer(buf);
  +   Fqn marshalAndUnmarshal(Fqn fqn) throws Exception
  +   {
  +      byte[] buf = Util.objectToByteBuffer(fqn);
  +      Fqn newFqn = (Fqn) Util.objectFromByteBuffer(buf);
         return newFqn;
      }
   
  -   void log(String msg) {
  +   void log(String msg)
  +   {
         System.out.println("-- " + msg);
      }
   
  -   public static Test suite() {
  +   public static Test suite()
  +   {
         return new TestSuite(FqnTest.class);
      }
   
  -   public static void main(String[] args) {
  +   public static void main(String[] args)
  +   {
         junit.textui.TestRunner.run(suite());
      }
   
  
  
  
  1.2       +31 -23    JBossCache/tests/functional/org/jboss/cache/GetKeysTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: GetKeysTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/GetKeysTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- GetKeysTest.java	8 Jul 2005 05:58:07 -0000	1.1
  +++ GetKeysTest.java	6 Sep 2006 15:31:01 -0000	1.2
  @@ -10,7 +10,6 @@
   import junit.framework.Test;
   import junit.framework.TestCase;
   import junit.framework.TestSuite;
  -import org.jboss.cache.TreeCache;
   
   import java.io.ByteArrayOutputStream;
   import java.io.ObjectOutputStream;
  @@ -19,70 +18,79 @@
   
   /**
    * @author <a href="mailto:bela at jboss.org">Bela Ban</a>
  - * @version $Id: GetKeysTest.java,v 1.1 2005/07/08 05:58:07 msurtani Exp $
  + * @version $Id: GetKeysTest.java,v 1.2 2006/09/06 15:31:01 msurtani Exp $
    */
  -public class GetKeysTest extends TestCase {
  +public class GetKeysTest extends TestCase
  +{
      TreeCache cache;
   
  -   public GetKeysTest(String s) {
  +   public GetKeysTest(String s)
  +   {
         super(s);
      }
   
  -   public void setUp() throws Exception {
  +   public void setUp() throws Exception
  +   {
         super.setUp();
      }
   
  -   public void tearDown() throws Exception {
  +   public void tearDown() throws Exception
  +   {
         super.tearDown();
      }
   
  -   public void testGetKeys() throws Exception {
  -      cache=new TreeCache();
  -      cache.createService();
  -      cache.startService();
  +   public void testGetKeys() throws Exception
  +   {
  +      cache = new TreeCache();
  +      cache.create();
  +      cache.start();
         cache.put("/a/b/c", "name", "Bela Ban");
         cache.put("/a/b/c", "age", new Integer(40));
         cache.put("/a/b/c", "city", "Kreuzlingen");
   
  -      Set keys=cache.getKeys("/a/b/c");
  +      Set keys = cache.getKeys("/a/b/c");
         log("keys are " + keys);
         assertNotNull(keys);
         assertEquals(3, keys.size());
   
  -      ByteArrayOutputStream outstream=new ByteArrayOutputStream(20);
  -      ObjectOutputStream out=new ObjectOutputStream(outstream);
  +      ByteArrayOutputStream outstream = new ByteArrayOutputStream(20);
  +      ObjectOutputStream out = new ObjectOutputStream(outstream);
         out.writeObject(keys); // must be serializable
      }
   
  -   public void testGetChildren() throws Exception {
  -      cache=new TreeCache();
  -      cache.createService();
  -      cache.startService();
  +   public void testGetChildren() throws Exception
  +   {
  +      cache = new TreeCache();
  +      cache.create();
  +      cache.start();
         cache.put("/a/b/c", null);
         cache.put("/a/b/c/1", null);
         cache.put("/a/b/c/2", null);
         cache.put("/a/b/c/3", null);
   
  -      Set children=cache.getChildrenNames("/a/b/c");
  +      Set children = cache.getChildrenNames("/a/b/c");
         log("children are " + children);
         assertNotNull(children);
         assertEquals(3, children.size());
   
  -      ByteArrayOutputStream outstream=new ByteArrayOutputStream(20);
  -      ObjectOutputStream out=new ObjectOutputStream(outstream);
  +      ByteArrayOutputStream outstream = new ByteArrayOutputStream(20);
  +      ObjectOutputStream out = new ObjectOutputStream(outstream);
         out.writeObject(children); // must be serializable
      }
   
   
  -   void log(String msg) {
  +   void log(String msg)
  +   {
         System.out.println("-- " + msg);
      }
   
  -   public static Test suite() {
  +   public static Test suite()
  +   {
         return new TestSuite(GetKeysTest.class);
      }
   
  -   public static void main(String[] args) {
  +   public static void main(String[] args)
  +   {
         junit.textui.TestRunner.run(suite());
      }
   
  
  
  
  1.18      +29 -29    JBossCache/tests/functional/org/jboss/cache/InterceptorConfigurationTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: InterceptorConfigurationTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/InterceptorConfigurationTest.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -b -r1.17 -r1.18
  --- InterceptorConfigurationTest.java	5 Sep 2006 11:24:45 -0000	1.17
  +++ InterceptorConfigurationTest.java	6 Sep 2006 15:31:01 -0000	1.18
  @@ -34,8 +34,8 @@
         super.tearDown();
         if (cache != null)
         {
  -         cache.stopService();
  -         cache.destroyService();
  +         cache.stop();
  +         cache.destroy();
         }
      }
   
  @@ -107,7 +107,7 @@
         cache.getConfiguration().setCacheLoaderConfiguration(getCacheLoaderConfig(false, false));
         cache.getConfiguration().setCacheMode("REPL_ASYNC");
         cache.getConfiguration().setFetchInMemoryState(false);
  -      cache.createService();
  +      cache.create();
         Interceptor chain = new InterceptorChainFactory().buildInterceptorChain(cache);
         List<Interceptor> list = InterceptorChainFactory.asList(chain);
         Iterator<Interceptor> interceptors = list.iterator();
  @@ -134,7 +134,7 @@
         cache.getConfiguration().setCacheLoaderConfiguration(getCacheLoaderConfig(false, true));
         cache.getConfiguration().setCacheMode("REPL_ASYNC");
         cache.getConfiguration().setFetchInMemoryState(false);
  -      cache.createService();
  +      cache.create();
         Interceptor chain = new InterceptorChainFactory().buildInterceptorChain(cache);
         List<Interceptor> list = InterceptorChainFactory.asList(chain);
         Iterator<Interceptor> interceptors = list.iterator();
  @@ -231,7 +231,7 @@
         cache.getConfiguration().setUseInterceptorMbeans(false);
         cache.getConfiguration().setNodeLockingOptimistic(true);
         cache.getConfiguration().setCacheLoaderConfiguration(getCacheLoaderConfig(false, false));
  -      cache.createService();
  +      cache.create();
         Interceptor next = new InterceptorChainFactory().buildInterceptorChain(cache);
   
         // test the chain size.
  @@ -257,7 +257,7 @@
         cache.getConfiguration().setUseInterceptorMbeans(false);
         cache.getConfiguration().setNodeLockingOptimistic(true);
         cache.getConfiguration().setCacheLoaderConfiguration(getCacheLoaderConfig(true, false));
  -      cache.createService();
  +      cache.create();
         Interceptor next = new InterceptorChainFactory().buildInterceptorChain(cache);
   
         // test the chain size.
  @@ -373,7 +373,7 @@
         cache.getConfiguration().setCacheMode("REPL_SYNC");
         cache.getConfiguration().setBuddyReplicationConfig(XmlHelper.stringToElement(xmlString));
         cache.getConfiguration().setNodeLockingScheme("OPTIMISTIC");
  -      cache._createService(); // initialise various subsystems such as BRManager
  +      cache.create(); // initialise various subsystems such as BRManager
         Interceptor chain = new InterceptorChainFactory().buildInterceptorChain(cache);
   
         List<Interceptor> list = InterceptorChainFactory.asList(chain);
  @@ -406,7 +406,7 @@
         xmlString += "</config>";
         cache.getConfiguration().setCacheMode("REPL_SYNC");
         cache.getConfiguration().setBuddyReplicationConfig(XmlHelper.stringToElement(xmlString));
  -      cache._createService(); // initialise various subsystems such as BRManager
  +      cache.create(); // initialise various subsystems such as BRManager
         Interceptor chain = new InterceptorChainFactory().buildInterceptorChain(cache);
   
         List<Interceptor> list = InterceptorChainFactory.asList(chain);
  
  
  
  1.4       +44 -31    JBossCache/tests/functional/org/jboss/cache/LifeCycleTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: LifeCycleTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/LifeCycleTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -b -r1.3 -r1.4
  --- LifeCycleTest.java	20 Jul 2006 09:03:55 -0000	1.3
  +++ LifeCycleTest.java	6 Sep 2006 15:31:01 -0000	1.4
  @@ -5,8 +5,8 @@
   import junit.framework.TestSuite;
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  -import org.jboss.cache.transaction.DummyTransactionManager;
   import org.jboss.cache.config.Configuration;
  +import org.jboss.cache.transaction.DummyTransactionManager;
   
   import javax.transaction.NotSupportedException;
   import javax.transaction.SystemException;
  @@ -14,17 +14,20 @@
   
   /**
    * Tests restart (stop-destroy-create-start) of TreeCache
  + *
    * @author Bela Ban
  - * @version $Id: LifeCycleTest.java,v 1.3 2006/07/20 09:03:55 msurtani Exp $
  + * @version $Id: LifeCycleTest.java,v 1.4 2006/09/06 15:31:01 msurtani Exp $
    */
  -public class LifeCycleTest extends TestCase {
  +public class LifeCycleTest extends TestCase
  +{
   
       private static Log log = LogFactory.getLog(LifeCycleTest.class);
   
  -   public void testLocalRestartNoTransactions() throws Exception {
  -      TreeCache cache=createCache(Configuration.CacheMode.LOCAL);
  -      cache.createService();
  -      cache.startService();
  +   public void testLocalRestartNoTransactions() throws Exception
  +   {
  +      TreeCache cache = createCache(Configuration.CacheMode.LOCAL);
  +      cache.create();
  +      cache.start();
   
         cache.put("/a/b/c", null);
         assertTrue(cache.getNumberOfNodes() > 0);
  @@ -39,12 +42,13 @@
      }
   
   
  -   public void testLocalRestartWithTransactions() throws Exception {
  -      TreeCache cache=createCache(Configuration.CacheMode.LOCAL);
  -      cache.createService();
  -      cache.startService();
  +   public void testLocalRestartWithTransactions() throws Exception
  +   {
  +      TreeCache cache = createCache(Configuration.CacheMode.LOCAL);
  +      cache.create();
  +      cache.start();
   
  -      Transaction tx=beginTransaction();
  +      Transaction tx = beginTransaction();
   
         cache.put("/a/b/c", null);
         log.debug("cache locks before restart:\n" + cache.printLockInfo());
  @@ -61,8 +65,9 @@
         assertEquals(0, cache.getNumberOfLocksHeld());
      }
   
  -   public void testStartNoCreate() throws Exception {
  -      TreeCache cache=createCache(Configuration.CacheMode.LOCAL);
  +   public void testStartNoCreate() throws Exception
  +   {
  +      TreeCache cache = createCache(Configuration.CacheMode.LOCAL);
         cache.start();
   
         cache.put("/a/b/c", null);
  @@ -77,8 +82,9 @@
         assertEquals(0, cache.getNumberOfLocksHeld());
      }
   
  -   public void testReStartNoCreate() throws Exception {
  -      TreeCache cache=createCache(Configuration.CacheMode.LOCAL);
  +   public void testReStartNoCreate() throws Exception
  +   {
  +      TreeCache cache = createCache(Configuration.CacheMode.LOCAL);
         cache.start();
         cache.stop();
         cache.start();
  @@ -95,43 +101,50 @@
         assertEquals(0, cache.getNumberOfLocksHeld());
      }
   
  -   TreeCache createCache(Configuration.CacheMode cache_mode) throws Exception {
  -      TreeCache retval=new TreeCache();
  +   TreeCache createCache(Configuration.CacheMode cache_mode) throws Exception
  +   {
  +      TreeCache retval = new TreeCache();
         retval.getConfiguration().setCacheMode(cache_mode);
         retval.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
         return retval;
      }
   
   
  -   Transaction beginTransaction() throws SystemException, NotSupportedException {
  -      DummyTransactionManager mgr=DummyTransactionManager.getInstance();
  +   Transaction beginTransaction() throws SystemException, NotSupportedException
  +   {
  +      DummyTransactionManager mgr = DummyTransactionManager.getInstance();
         mgr.begin();
  -      Transaction tx=mgr.getTransaction();
  +      Transaction tx = mgr.getTransaction();
         return tx;
      }
   
   
  -   void startCache(TreeCache c) throws Exception {
  -      c.createService();
  -      c.startService();
  +   void startCache(TreeCache c) throws Exception
  +   {
  +      c.create();
  +      c.start();
      }
   
  -   void stopCache(TreeCache c) {
  -      c.stopService();
  -      c.destroyService();
  +   void stopCache(TreeCache c)
  +   {
  +      c.stop();
  +      c.destroy();
      }
   
  -   void restartCache(TreeCache c) throws Exception {
  +   void restartCache(TreeCache c) throws Exception
  +   {
         stopCache(c);
         startCache(c);
      }
   
   
  -   public static Test suite() {
  +   public static Test suite()
  +   {
         return new TestSuite(LifeCycleTest.class);
      }
   
  -   public static void main(String[] args) {
  +   public static void main(String[] args)
  +   {
         junit.textui.TestRunner.run(suite());
      }
   
  
  
  
  1.5       +43 -31    JBossCache/tests/functional/org/jboss/cache/TreeCacheFunctionalTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: TreeCacheFunctionalTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/TreeCacheFunctionalTest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -b -r1.4 -r1.5
  --- TreeCacheFunctionalTest.java	25 Aug 2006 11:59:03 -0000	1.4
  +++ TreeCacheFunctionalTest.java	6 Sep 2006 15:31:01 -0000	1.5
  @@ -11,42 +11,48 @@
   
   /**
    * Simple functional tests for TreeCache
  + *
    * @author Bela Ban
  - * @version $Id: TreeCacheFunctionalTest.java,v 1.4 2006/08/25 11:59:03 msurtani Exp $
  + * @version $Id: TreeCacheFunctionalTest.java,v 1.5 2006/09/06 15:31:01 msurtani Exp $
    */
  -public class TreeCacheFunctionalTest extends TestCase {
  -   TreeCache cache=null;
  -   Transaction tx=null;
  -   final Fqn FQN=Fqn.fromString("/myNode");
  -   final String KEY="key";
  -   final String VALUE="value";
  +public class TreeCacheFunctionalTest extends TestCase
  +{
  +   TreeCache cache = null;
  +   Transaction tx = null;
  +   final Fqn FQN = Fqn.fromString("/myNode");
  +   final String KEY = "key";
  +   final String VALUE = "value";
      Exception ex;
   
   
  -   protected void setUp() throws Exception {
  +   protected void setUp() throws Exception
  +   {
         super.setUp();
  -      cache=new TreeCache();
  +      cache = new TreeCache();
         cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
         cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
         cache.getConfiguration().setIsolationLevel(IsolationLevel.REPEATABLE_READ);
  -      cache.createService();
  -      cache.startService();
  -      ex=null;
  +      cache.create();
  +      cache.start();
  +      ex = null;
      }
   
  -   protected void tearDown() throws Exception {
  +   protected void tearDown() throws Exception
  +   {
         super.tearDown();
  -      if(cache != null) {
  -         cache.stopService();
  -         cache.destroyService();
  -         cache=null;
  +      if (cache != null)
  +      {
  +         cache.stop();
  +         cache.destroy();
  +         cache = null;
         }
  -      if(ex != null)
  +      if (ex != null)
            throw ex;
      }
   
   
  -   public void testPut() throws CacheException {
  +   public void testPut() throws CacheException
  +   {
         cache.put("/a/b/c", "age", new Integer(38));
         assertEquals(cache.get("/a/b/c", "age"), new Integer(38));
         assertNotNull(cache.get("/a/b/c"));
  @@ -55,27 +61,30 @@
      }
   
   
  -
  -   public void testPutNullKey() throws CacheException {
  -      Object key=null;
  +   public void testPutNullKey() throws CacheException
  +   {
  +      Object key = null;
         cache.put("/a/b/c", key, "val");
         System.out.println("value of /a/b/c " + cache.print("/a/b/c"));
      }
   
  -   public void testPutNullValue() throws CacheException {
  -      Object val=null;
  +   public void testPutNullValue() throws CacheException
  +   {
  +      Object val = null;
         cache.put("/a/b/c", "key", val);
         System.out.println("value of /a/b/c " + cache.print("/a/b/c"));
      }
   
  -   public void testPutNullKeyAndValues() throws CacheException {
  -      Object key=null, val=null;
  +   public void testPutNullKeyAndValues() throws CacheException
  +   {
  +      Object key = null, val = null;
         cache.put("/a/b/c", key, val);
         System.out.println("value of /a/b/c " + cache.print("/a/b/c"));
      }
   
  -   public void testPutMapsWithNullValues() throws CacheException {
  -      HashMap map=new HashMap();
  +   public void testPutMapsWithNullValues() throws CacheException
  +   {
  +      HashMap map = new HashMap();
         map.put("key", null);
         map.put(null, "val");
         map.put("a", "b");
  @@ -84,7 +93,8 @@
         System.out.println("value of /a/b/c " + cache.print("/a/b/c"));
      }
   
  -   public void testPutKeys() throws CacheException {
  +   public void testPutKeys() throws CacheException
  +   {
         cache.put("/a/b/c", "age", new Integer(38));
         cache.put("/a/b/c", "name", "Bela");
         assertEquals(cache.get("/a/b/c", "age"), new Integer(38));
  @@ -95,7 +105,8 @@
         assertEquals(0, cache.getLockTable().size());
      }
   
  -   public void testRemove() throws CacheException {
  +   public void testRemove() throws CacheException
  +   {
         cache.put("/a/b/c", null);
         cache.put("/a/b/c/1", null);
         cache.put("/a/b/c/2", null);
  @@ -107,7 +118,8 @@
         assertEquals(0, cache.getLockTable().size());
      }
   
  -   public static Test suite() {
  +   public static Test suite()
  +   {
         return new TestSuite(TreeCacheFunctionalTest.class);
      }
   
  
  
  
  1.2       +54 -49    JBossCache/tests/functional/org/jboss/cache/TreeNodeTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: TreeNodeTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/TreeNodeTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- TreeNodeTest.java	2 Sep 2005 00:33:06 -0000	1.1
  +++ TreeNodeTest.java	6 Sep 2006 15:31:01 -0000	1.2
  @@ -3,15 +3,16 @@
   import junit.framework.Test;
   import junit.framework.TestCase;
   import junit.framework.TestSuite;
  -import org.jboss.cache.TreeCache;
   
   /**
    * Tests restart (stop-destroy-create-start) of TreeCache
  + *
    * @author Bela Ban
  - * @version $Id: TreeNodeTest.java,v 1.1 2005/09/02 00:33:06 bwang Exp $
  + * @version $Id: TreeNodeTest.java,v 1.2 2006/09/06 15:31:01 msurtani Exp $
    */
  -public class TreeNodeTest extends TestCase {
  -   TreeCache cache ;
  +public class TreeNodeTest extends TestCase
  +{
  +   TreeCache cache;
   
      protected void setUp() throws Exception
      {
  @@ -44,60 +45,64 @@
      }
   
      /**
  -   public void testRelocate() throws Exception
  -   {
  -      Object key = new Integer(1);
  -      cache.put("/a/b/c", key, "test");
  -      cache.put("/a/b/c/d", key, "test1");
  -      cache.put("/relocate", "1", "1");
  -
  -      DataNode node = cache.get("/a/b/c");
  -      DataNode newParentNode = cache.get("/relocate");
  -      assertFalse(newParentNode.hasChildren());
  -
  -      Fqn newFqn = Fqn.fromString("/relocate/c");
  -
  -      cache.put("/relocate/c", "1", "1");
  -
  -      node.relocate(newParentNode, newFqn);
  -      assertNotNull("/relocat/c should not be null", cache.get(newFqn));
  -
  -      node = cache.get("/a/b");
  -      assertTrue(!node.hasChildren());
  -      assertTrue(!node.childExists("c"));
  -
  -      node = cache.get("/relocate");
  -      assertTrue(node.hasChildren());
  -      assertTrue(node.childExists(newFqn.get(1)));
  -
  -      node = cache.get(newFqn);
  -      assertEquals(newFqn, node.getFqn());
  -      assertTrue(node.hasChildren());
  -      assertTrue(node.childExists("d"));
  -
  -      node = cache.get("/relocate/c/d");
  -      assertNotNull(node);
  -      assertEquals("test1", cache.get("/relocate/c/d", key));
  -
  -      assertNull(cache.get("/relocate/c/","1"));
  -   }
  +    * public void testRelocate() throws Exception
  +    * {
  +    * Object key = new Integer(1);
  +    * cache.put("/a/b/c", key, "test");
  +    * cache.put("/a/b/c/d", key, "test1");
  +    * cache.put("/relocate", "1", "1");
  +    * <p/>
  +    * DataNode node = cache.get("/a/b/c");
  +    * DataNode newParentNode = cache.get("/relocate");
  +    * assertFalse(newParentNode.hasChildren());
  +    * <p/>
  +    * Fqn newFqn = Fqn.fromString("/relocate/c");
  +    * <p/>
  +    * cache.put("/relocate/c", "1", "1");
  +    * <p/>
  +    * node.relocate(newParentNode, newFqn);
  +    * assertNotNull("/relocat/c should not be null", cache.get(newFqn));
  +    * <p/>
  +    * node = cache.get("/a/b");
  +    * assertTrue(!node.hasChildren());
  +    * assertTrue(!node.childExists("c"));
  +    * <p/>
  +    * node = cache.get("/relocate");
  +    * assertTrue(node.hasChildren());
  +    * assertTrue(node.childExists(newFqn.get(1)));
  +    * <p/>
  +    * node = cache.get(newFqn);
  +    * assertEquals(newFqn, node.getFqn());
  +    * assertTrue(node.hasChildren());
  +    * assertTrue(node.childExists("d"));
  +    * <p/>
  +    * node = cache.get("/relocate/c/d");
  +    * assertNotNull(node);
  +    * assertEquals("test1", cache.get("/relocate/c/d", key));
  +    * <p/>
  +    * assertNull(cache.get("/relocate/c/","1"));
  +    * }
       */
   
  -   void startCache(TreeCache c) throws Exception {
  -      c.createService();
  -      c.startService();
  +   void startCache(TreeCache c) throws Exception
  +   {
  +      c.create();
  +      c.start();
      }
   
  -   void stopCache(TreeCache c) {
  -      c.stopService();
  -      c.destroyService();
  +   void stopCache(TreeCache c)
  +   {
  +      c.stop();
  +      c.destroy();
      }
   
  -   public static Test suite() {
  +   public static Test suite()
  +   {
         return new TestSuite(TreeNodeTest.class);
      }
   
  -   public static void main(String[] args) {
  +   public static void main(String[] args)
  +   {
         junit.textui.TestRunner.run(suite());
      }
   
  
  
  



More information about the jboss-cvs-commits mailing list