Hello geronimo-dev,

The patch to the SimpleInstanceCacheTest is attached.
New test and classes needed for it are in the jar.

Also since someone added me to contributors (!) list in the
project.xml I filled the email tag there in patch2.txt (just in case)

-- 
Best regards,
 Ed                          mailto:[EMAIL PROTECTED]
? AbstractInstanceCacheTest.java
? LRUInstanceCacheTest.java
? MockLRURunner.java
? patch.txt
Index: SimpleInstanceCacheTest.java
===================================================================
RCS file: 
/home/cvspublic/incubator-geronimo/modules/core/src/test/org/apache/geronimo/cache/SimpleInstanceCacheTest.java,v
retrieving revision 1.1
diff -u -r1.1 SimpleInstanceCacheTest.java
--- SimpleInstanceCacheTest.java        12 Aug 2003 10:53:41 -0000      1.1
+++ SimpleInstanceCacheTest.java        13 Aug 2003 00:04:30 -0000
@@ -56,157 +56,25 @@
 
 package org.apache.geronimo.cache;
 
-import junit.framework.TestCase;
 
 /**
+ * Tests the [EMAIL PROTECTED] SimpleInstanceCache} implementation of [EMAIL 
PROTECTED] InstanceCache} interface.
  * @version $Revision: 1.1 $ $Date: 2003/08/12 10:53:41 $
  */
-public class SimpleInstanceCacheTest extends TestCase {
-    protected InstanceCache cache;
-    Object key;
-    Object value;
+public class SimpleInstanceCacheTest extends AbstractInstanceCacheTest {
 
     public SimpleInstanceCacheTest(String name) {
         super(name);
     }
 
     public void setUp() {
-        key = new Object();
-        value = new Object();
         cache = new SimpleInstanceCache();
-    }
-
-    /**
-     * Tests that an object
-     * 1) can be put to the cache as active
-     * 2) is considered active
-     * 3) cant be retreived from it
-     * @throws Exception if an exception happens while testing
-     */
-    public void testPutGetActive() throws Exception {
-        cache.putActive(key, value);
-        assertTrue("Object is in fact active", cache.isActive(key));
-        Object value1 = cache.get(key);
-        assertNotNull("Object returned is not null", value1);
-        assertEquals("Object returned is the same as the object inserted", 
value, value1);
-    }
-
-    /**
-     * Tests that an object
-     * 1) can be put to the cache as inactive
-     * 2) is not considered active
-     * 3) can be retreived from it
-     * 4) becomes active after retreival
-     * @throws Exception if an exception happens while testing
-     */
-    public void testPutGetInactive() throws Exception {
-        cache.putInactive(key, value);
-        assertFalse("Object is in fact NOT active", cache.isActive(key));
-        Object value1 = cache.get(key);
-        assertNotNull("Object returned is not null", value1);
-        assertEquals("Object returned is the same as the object inserted", 
value, value1);
-        assertTrue("Object has become active", cache.isActive(key));
-    }
-
-    /**
-     * Tests that an object
-     * 1) can be put to the cache as active
-     * 2) is considered active
-     * 3) can be put again as inactive
-     * 4) becomes inactive
-     * @throws Exception if an exception happens while testing
-     */
-    public void testPutInactiveAfterActive() throws Exception {
-        cache.putActive(key, value);
-        assertTrue("Object is in fact active", cache.isActive(key));
-        cache.putInactive(key, value);
-        assertFalse("Object has becode inactive", cache.isActive(key));
-    }
-
-    /**
-     * Tests that an object
-     * 1) can be put to the cache as inactive
-     * 2) is not considered active
-     * 3) can be put again as active
-     * 4) becomes active
-     * @throws Exception if an exception happens while testing
-     */
-    public void testPutActiveAfterInactive() throws Exception {
-        cache.putInactive(key, value);
-        assertFalse("Object is in fact NOT active", cache.isActive(key));
-        cache.putActive(key, value);
-        assertTrue("Object has becode active", cache.isActive(key));
-    }
-    /**
-     * Tests that an object
-     * 1) can be put as active
-     * 2) the same object is returned while removing
-     * 3) actually removed
-     * @throws Exception
-     */
-    public void testRemoveActive() throws Exception {
-        cache.putActive(key,value);
-        assertTrue("Object is in fact active", cache.isActive(key));
-        Object value1 = cache.remove(key);
-        assertNotNull("Object is found",value1);
-        assertEquals("Object is the same as object inserted",value,value1);
-        Object value2 = cache.get(key);
-        assertNull("Object is in fact removed",value2);
-    }
-
-    /**
-     * Tests that an object
-     * 1) can be put as inactive
-     * 2) the same object is returned while removing
-     * 3) actually removed
-     * @throws Exception
-     */
-    public void testRemoveInactive() throws Exception {
-        cache.putInactive(key,value);
-        assertFalse("Object is in fact NOT active", cache.isActive(key));
-        Object value1 = cache.remove(key);
-        assertNotNull("Object is found",value1);
-        assertEquals("Object is the same as object inserted",value,value1);
-        Object value2 = cache.get(key);
-        assertNull("Object is in fact removed",value2);
-    }
-
-    /**
-     * Tests that an object
-     * 1) can be put as active
-     * 2) can be peeked
-     * 3) stays active
-     * @throws Exception
-     */
-    public void testPeekActive() throws Exception {
-        cache.putActive(key, value);
-        assertTrue("Object is in fact active", cache.isActive(key));
-        Object value1 = cache.get(key);
-        assertNotNull("Object returned is not null", value1);
-        assertEquals("Object returned is the same as the object inserted", 
value, value1);
-        assertTrue("Object has NOT become inactive after peek", 
cache.isActive(key));
-    }
-
-    /**
-     * Tests that an object
-     * 1) can be put as inactive
-     * 2) can be peeked
-     * 3) stays inactive
-     * @throws Exception
-     */
-    public void testPeekInactive() throws Exception {
-        cache.putInactive(key, value);
-        assertFalse("Object is in fact NOT active", cache.isActive(key));
-        Object value1 = cache.peek(key);
-        assertNotNull("Object returned is not null", value1);
-        assertEquals("Object returned is the same as the object inserted", 
value, value1);
-        assertFalse("Object has NOT become active after peek", 
cache.isActive(key));
+        super.setUp();
     }
 
     public void tearDown() {
+        super.tearDown();
         cache = null;
-        key = null;
-        value = null;
     }
 
 }

Attachment: LRUInstanceCacheTest.jar
Description: Binary data

? patch.txt
Index: project.xml
===================================================================
RCS file: /home/cvspublic/incubator-geronimo/etc/project.xml,v
retrieving revision 1.1
diff -u -r1.1 project.xml
--- project.xml 12 Aug 2003 14:44:09 -0000      1.1
+++ project.xml 13 Aug 2003 00:16:05 -0000
@@ -201,7 +201,7 @@
   <contributors>
     <contributor>
       <name>Ed Letifov</name>
-      <email></email>
+      <email>[EMAIL PROTECTED]</email>
     </contributor>
   </contributors>
   

Reply via email to