openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From curti...@apache.org
Subject svn commit: r964170 - in /openjpa/trunk: openjpa-kernel/src/main/java/org/apache/openjpa/datacache/AbstractQueryCache.java openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/querycache/TestQueryCache.java
Date Wed, 14 Jul 2010 20:15:41 GMT
Author: curtisr7
Date: Wed Jul 14 20:15:41 2010
New Revision: 964170

URL: http://svn.apache.org/viewvc?rev=964170&view=rev
Log:
OPENJPA-1626: Add Name property to AbstractQueryCache, contributed by Amy Yang.

Modified:
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/AbstractQueryCache.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/querycache/TestQueryCache.java

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/AbstractQueryCache.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/AbstractQueryCache.java?rev=964170&r1=964169&r2=964170&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/AbstractQueryCache.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/AbstractQueryCache.java
Wed Jul 14 20:15:41 2010
@@ -72,6 +72,9 @@ public abstract class AbstractQueryCache
 
     protected ConcurrentHashMap<String,Long> entityTimestampMap = null;
     private boolean _closed = false;
+    
+    private String _name = null;
+    
     // default evict policy
     public EvictPolicy evictPolicy = EvictPolicy.DEFAULT;
 
@@ -407,4 +410,12 @@ public abstract class AbstractQueryCache
         }
         return tmval;
     }
+    
+    public void setName(String n) {
+        _name = n;
+    }
+
+    public String getName() {
+        return _name;
+    }
 }

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/querycache/TestQueryCache.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/querycache/TestQueryCache.java?rev=964170&r1=964169&r2=964170&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/querycache/TestQueryCache.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/querycache/TestQueryCache.java
Wed Jul 14 20:15:41 2010
@@ -23,6 +23,8 @@ import java.util.List;
 import javax.persistence.EntityManager;
 import javax.persistence.NamedQuery;
 
+import org.apache.openjpa.datacache.ConcurrentQueryCache;
+import org.apache.openjpa.datacache.QueryCache;
 import org.apache.openjpa.persistence.querycache.common.apps.Entity1;
 import org.apache.openjpa.persistence.querycache.common.apps.Entity2;
 import org.apache.openjpa.persistence.test.SQLListenerTestCase;
@@ -32,11 +34,11 @@ import org.apache.openjpa.persistence.te
 public class TestQueryCache extends SQLListenerTestCase {
 
     EntityManager em;
-
+    private static final String CACHE_NAME = "QueryCacheName";
     public void setUp() {
         super.setUp(
             DROP_TABLES,
-            "openjpa.QueryCache", "true", 
+            "openjpa.QueryCache", "true(name="+CACHE_NAME+")", 
             "openjpa.RemoteCommitProvider","sjvm",
             Entity1.class,Entity2.class
         // ,"openjpa.Log","SQL=trace"
@@ -148,6 +150,13 @@ public class TestQueryCache extends SQLL
 
     }
 
+    public void testName() {
+        ConcurrentQueryCache qCache =
+            (ConcurrentQueryCache) emf.getConfiguration().getDataCacheManagerInstance().getSystemQueryCache();
+        assertNotNull(qCache);
+        assertEquals(CACHE_NAME, qCache.getName());
+    }
+
     protected void startTx(EntityManager em) {
         em.getTransaction().begin();
     }



Mime
View raw message