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

Manik Surtani msurtani at jboss.com
Thu Jan 11 13:31:35 EST 2007


  User: msurtani
  Date: 07/01/11 13:31:35

  Added:       tests/functional/org/jboss/cache/marshall  Tag:
                        Branch_JBossCache_1_4_0 CustomCollectionTest.java
  Log:
  Fixed collection marshalling
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +125 -0    JBossCache/tests/functional/org/jboss/cache/marshall/Attic/CustomCollectionTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CustomCollectionTest.java
  ===================================================================
  RCS file: CustomCollectionTest.java
  diff -N CustomCollectionTest.java
  --- /dev/null	1 Jan 1970 00:00:00 -0000
  +++ CustomCollectionTest.java	11 Jan 2007 18:31:35 -0000	1.1.2.1
  @@ -0,0 +1,125 @@
  +package org.jboss.cache.marshall;
  +
  +import junit.framework.TestCase;
  +import org.jboss.cache.TreeCache;
  +import org.jboss.cache.lock.IsolationLevel;
  +
  +import java.util.ArrayList;
  +import java.util.Set;
  +import java.util.Map;
  +import java.util.HashSet;
  +import java.util.HashMap;
  +import java.util.LinkedList;
  +import java.util.TreeSet;
  +import java.util.TreeMap;
  +
  +
  +public class CustomCollectionTest extends TestCase
  +{
  +   private TreeCache cache1 =null;
  +   private TreeCache cache2 =null;
  +
  +   protected void setUp() throws Exception
  +   {
  +      super.setUp();
  +
  +      cache1 =new TreeCache();
  +      cache1.setCacheMode(TreeCache.REPL_SYNC);
  +      cache1.setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
  +      cache1.setIsolationLevel(IsolationLevel.REPEATABLE_READ);
  +      cache1.createService();
  +      cache1.startService();
  +
  +      cache2 =new TreeCache();
  +      cache2.setCacheMode(TreeCache.REPL_SYNC);
  +      cache2.setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
  +      cache2.setIsolationLevel(IsolationLevel.REPEATABLE_READ);
  +      cache2.createService();
  +      cache2.startService();
  +
  +   }
  +
  +   protected void tearDown() throws Exception
  +   {
  +      cache1.stopService();
  +      cache2.stopService();
  +   }
  +
  +   public void testList() throws Exception
  +   {
  +      cache1.put("/a", "key", new MyArrayList());
  +      Object o = cache2.get("/a", "key");
  +      assertTrue(o instanceof ArrayList);
  +      assertTrue(o instanceof MyArrayList);
  +   }
  +
  +   public void testSet() throws Exception
  +   {
  +      cache1.put("/a", "key", new MySet());
  +      Object o = cache2.get("/a", "key");
  +      assertTrue(o instanceof Set);
  +      assertTrue(o instanceof MySet);
  +   }
  +
  +   public void testMap() throws Exception
  +   {
  +      cache1.put("/a", "key", new MyMap());
  +      Object o = cache2.get("/a", "key");
  +      assertTrue(o instanceof Map);
  +      assertTrue(o instanceof MyMap);
  +   }
  +
  +   public void testControlList() throws Exception
  +   {
  +      cache1.put("/a", "key", new ArrayList());
  +      Object o = cache2.get("/a", "key");
  +      assertTrue(o instanceof ArrayList);
  +
  +      cache1.put("/a", "key", new LinkedList());
  +      o = cache2.get("/a", "key");
  +      assertTrue(o instanceof LinkedList);
  +
  +   }
  +
  +   public void testControlSet() throws Exception
  +   {
  +      cache1.put("/a", "key", new HashSet());
  +      Object o = cache2.get("/a", "key");
  +      assertTrue(o instanceof HashSet);
  +
  +      cache1.put("/a", "key", new TreeSet());
  +      o = cache2.get("/a", "key");
  +      assertTrue(o instanceof TreeSet);
  +
  +   }
  +
  +   public void testControlMap() throws Exception
  +   {
  +      cache1.put("/a", "key", new HashMap());
  +      Object o = cache2.get("/a", "key");
  +      assertTrue(o instanceof HashMap);
  +
  +      cache1.put("/a", "key", new TreeMap());
  +      o = cache2.get("/a", "key");
  +      assertTrue(o instanceof TreeMap);      
  +   }
  +
  +   // TODO add tests here to check region-based marshalling with custom collection types in a context class loader.
  +
  +   public void log(Object o)
  +   {
  +      System.out.println(o);
  +   }
  +}
  +
  +   class MyArrayList extends ArrayList
  +   {
  +   }
  +
  +   class MySet extends HashSet
  +   {
  +   }
  +
  +   class MyMap extends HashMap
  +   {
  +   }
  
  
  



More information about the jboss-cvs-commits mailing list