You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by fr...@apache.org on 2002/02/11 21:23:53 UTC

cvs commit: jakarta-commons-sandbox/simplestore/src/test/org/apache/commons/simplestore TestStore.java TestSoftRefMemoryStore.java TestSample.java

froehlich    02/02/11 12:23:53

  Modified:    simplestore/src/test/org/apache/commons/simplestore
                        TestStore.java TestSoftRefMemoryStore.java
                        TestSample.java
  Log:
  re-structured repository
  
  Revision  Changes    Path
  1.3       +7 -5      jakarta-commons-sandbox/simplestore/src/test/org/apache/commons/simplestore/TestStore.java
  
  Index: TestStore.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/src/test/org/apache/commons/simplestore/TestStore.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestStore.java	9 Feb 2002 18:57:05 -0000	1.2
  +++ TestStore.java	11 Feb 2002 20:23:53 -0000	1.3
  @@ -55,6 +55,8 @@
    
   package org.apache.commons.simplestore;
   
  +import org.apache.commons.simplestore.cache.Cache;
  +
   import java.util.Collection;
   import java.util.Map;
   import junit.framework.*;
  @@ -62,11 +64,11 @@
   /**
    *@author     Gerhard Froehlich <a href="mailto:g-froehlich@gmx.de">
    *      g-froehlich@gmx.de</a>
  - *@version    $Id: TestStore.java,v 1.2 2002/02/09 18:57:05 froehlich Exp $
  + *@version    $Id: TestStore.java,v 1.3 2002/02/11 20:23:53 froehlich Exp $
    */
   public abstract class TestStore extends TestObject {
   
  -    protected Store store = null;
  +    protected Cache cache = null;
   
       public TestStore(String testName) {
           super(testName);
  @@ -77,7 +79,7 @@
        *
        *@return
        */
  -    public abstract Store makeStore();
  +    public abstract Cache makeStore();
   
       public Object makeObject() {
           return makeStore();
  @@ -94,9 +96,9 @@
        *@param  key
        *@param  val
        */
  -    protected void tryToPut(Store store, Object key, Object val) {
  +    protected void tryToPut(Cache cache, Object key, Object val) {
           try {
  -            store.put(key, val);
  +            cache.put(key, val);
           } catch (UnsupportedOperationException e) {
   
           } catch (ClassCastException e) {
  
  
  
  1.11      +12 -9     jakarta-commons-sandbox/simplestore/src/test/org/apache/commons/simplestore/TestSoftRefMemoryStore.java
  
  Index: TestSoftRefMemoryStore.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/src/test/org/apache/commons/simplestore/TestSoftRefMemoryStore.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- TestSoftRefMemoryStore.java	10 Feb 2002 10:00:12 -0000	1.10
  +++ TestSoftRefMemoryStore.java	11 Feb 2002 20:23:53 -0000	1.11
  @@ -54,6 +54,9 @@
    */
   package org.apache.commons.simplestore;
   
  +import org.apache.commons.simplestore.cache.Cache;
  +import org.apache.commons.simplestore.cache.impl.SoftRefMemoryCache;
  +
   import java.util.HashMap;
   import java.util.Map;
   import junit.framework.Test;
  @@ -65,7 +68,7 @@
    *      g-froehlich@gmx.de</a>
    *@author     Juozas Baliuka <a href="mailto:baliuka@mwm.lt">
    *      baliuka@mwm.lt</a>
  - *@version    $Id: TestSoftRefMemoryStore.java,v 1.10 2002/02/10 10:00:12 baliuka Exp $
  + *@version    $Id: TestSoftRefMemoryStore.java,v 1.11 2002/02/11 20:23:53 froehlich Exp $
    */
   public class TestSoftRefMemoryStore extends TestStore {
   
  @@ -87,9 +90,9 @@
           junit.textui.TestRunner.main(testCaseName);
       }
   
  -    public Store makeStore() {
  -        SoftRefMemoryStore store = new SoftRefMemoryStore(new HashMap(ITERATIONS),  MAX_STRONG_REFS);
  -        return store;
  +    public Cache makeStore() {
  +        cache = SoftRefMemoryCache.getInstance(new HashMap(ITERATIONS),  MAX_STRONG_REFS);
  +        return cache;
       }
   
       public void testStore() {
  @@ -100,9 +103,9 @@
           java.util.Arrays.fill(testObject, '.');
           Object key = new Integer(0);
           Object value = new String(testObject);
  -        store.put(key, value);
  +        cache.put(key, value);
           for (int i = 1; i < ITERATIONS; i++) {
  -            store.put(new Integer(i), new String(testObject));
  +            cache.put(new Integer(i), new String(testObject));
               _testGet(i);
           }
           // get something
  @@ -110,14 +113,14 @@
                   i < ITERATIONS / 2; i++) {
               _testGet(i);
           }
  -        assertEquals("Lost Strong Referense in cache", store.get(key), value);
  +        assertEquals("Lost Strong Referense in cache", cache.get(key), value);
   
       }
   
   
       protected void setUp() throws java.lang.Exception {
           super.setUp();
  -        store = makeStore();
  +        cache = makeStore();
       }
   
       private void _testGet(int lastKey) {
  @@ -131,7 +134,7 @@
                   i += (MAX_STRONG_REFS / 2 + 1)) {
   
               Object key = new Integer(i);
  -            Object object = store.get(key);
  +            Object object = cache.get(key);
   
               if (object == null) {
                   System.out.println(key + " removed from memory ");
  
  
  
  1.3       +6 -3      jakarta-commons-sandbox/simplestore/src/test/org/apache/commons/simplestore/TestSample.java
  
  Index: TestSample.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/src/test/org/apache/commons/simplestore/TestSample.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestSample.java	9 Feb 2002 18:57:05 -0000	1.2
  +++ TestSample.java	11 Feb 2002 20:23:53 -0000	1.3
  @@ -59,13 +59,16 @@
   import junit.framework.Test;
   import junit.framework.TestCase;
   import junit.framework.TestSuite;
  -import org.apache.commons.simplestore.jdbc.*;
  -import org.apache.commons.simplestore.persistence.*;
  +import org.apache.commons.simplestore.persistence.impl.DBStorage;
  +import org.apache.commons.simplestore.persistence.Transaction;
  +
  +import org.apache.commons.simplestore.jdbc.DriverDataSource;
  +import org.apache.commons.simplestore.persistence.impl.PersistenceManager;
   
   /**
    *@author     Juozas Baliuka <a href="mailto:baliuka@mwm.lt">
    *      baliuka@mwm.lt</a>
  - *@version    $Id: TestSample.java,v 1.2 2002/02/09 18:57:05 froehlich Exp $
  + *@version    $Id: TestSample.java,v 1.3 2002/02/11 20:23:53 froehlich Exp $
    */
   public class TestSample extends TestCase {
   
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>