cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r649265 - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src: main/java/org/apache/cayenne/access/ main/java/org/apache/cayenne/query/ main/java/org/apache/cayenne/util/ test/java/org/apache/cayenne/query/
Date Thu, 17 Apr 2008 20:38:09 GMT
Author: aadamchik
Date: Thu Apr 17 13:38:06 2008
New Revision: 649265

URL: http://svn.apache.org/viewvc?rev=649265&view=rev
Log:
CAY-1035 Replace QueryMetadata String cache policies with an enum
(switched the runtime)

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataDomainQueryAction.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/NamedQuery.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/ProcedureQueryMetadata.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/RefreshQuery.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/SQLTemplateMetadata.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/SelectQueryMetadata.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/ObjectContextQueryAction.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/EJBQLQueryTest.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/ProcedureQueryCacheKeyTest.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/SQLTemplateCacheKeyTest.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/SelectQueryCacheKeyTest.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataDomainQueryAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataDomainQueryAction.java?rev=649265&r1=649264&r2=649265&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataDomainQueryAction.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataDomainQueryAction.java
Thu Apr 17 13:38:06 2008
@@ -45,6 +45,7 @@
 import org.apache.cayenne.query.PrefetchSelectQuery;
 import org.apache.cayenne.query.PrefetchTreeNode;
 import org.apache.cayenne.query.Query;
+import org.apache.cayenne.query.QueryCacheStrategy;
 import org.apache.cayenne.query.QueryMetadata;
 import org.apache.cayenne.query.QueryRouter;
 import org.apache.cayenne.query.RefreshQuery;
@@ -322,9 +323,9 @@
             return !DONE;
         }
 
-        boolean cache = QueryMetadata.SHARED_CACHE.equals(metadata.getCachePolicy());
+        boolean cache = QueryCacheStrategy.SHARED_CACHE == metadata.getCacheStrategy();
         boolean cacheOrCacheRefresh = cache
-                || QueryMetadata.SHARED_CACHE_REFRESH.equals(metadata.getCachePolicy());
+                || QueryCacheStrategy.SHARED_CACHE_REFRESH == metadata.getCacheStrategy();
 
         if (!cacheOrCacheRefresh) {
             return !DONE;
@@ -618,7 +619,7 @@
         void convert(List<DataRow> mainRows) {
 
             List<DataRow> normalized;
-            
+
             // convert data rows to standardized format...
             SQLResultSetMapping rsMapping = metadata.getResultSetMapping();
             if (rsMapping != null) {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/NamedQuery.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/NamedQuery.java?rev=649265&r1=649264&r2=649265&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/NamedQuery.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/NamedQuery.java
Thu Apr 17 13:38:06 2008
@@ -81,17 +81,17 @@
 
         // override cache policy, forcing refresh if needed
         if (forceNoCache) {
-            String policy = base.getCachePolicy();
+            QueryCacheStrategy strategy = base.getCacheStrategy();
 
-            if (QueryMetadata.LOCAL_CACHE.equals(policy)) {
+            if (QueryCacheStrategy.LOCAL_CACHE == strategy) {
                 wrapper.override(
-                        QueryMetadata.CACHE_POLICY_PROPERTY,
-                        QueryMetadata.LOCAL_CACHE_REFRESH);
+                        QueryMetadata.CACHE_STRATEGY_PROPERTY,
+                        QueryCacheStrategy.LOCAL_CACHE_REFRESH);
             }
-            else if (QueryMetadata.SHARED_CACHE.equals(policy)) {
+            else if (QueryCacheStrategy.SHARED_CACHE == strategy) {
                 wrapper.override(
-                        QueryMetadata.CACHE_POLICY_PROPERTY,
-                        QueryMetadata.SHARED_CACHE_REFRESH);
+                        QueryMetadata.CACHE_STRATEGY_PROPERTY,
+                        QueryCacheStrategy.SHARED_CACHE_REFRESH);
             }
         }
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/ProcedureQueryMetadata.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/ProcedureQueryMetadata.java?rev=649265&r1=649264&r2=649265&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/ProcedureQueryMetadata.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/ProcedureQueryMetadata.java
Thu Apr 17 13:38:06 2008
@@ -66,7 +66,7 @@
             }
 
             // generate unique cache key...
-            if (QueryMetadata.NO_CACHE.equals(getCachePolicy())) {
+            if (QueryCacheStrategy.NO_CACHE == getCacheStrategy()) {
 
             }
             else if (query.getName() != null) {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/RefreshQuery.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/RefreshQuery.java?rev=649265&r1=649264&r2=649265&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/RefreshQuery.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/RefreshQuery.java
Thu Apr 17 13:38:06 2008
@@ -27,7 +27,7 @@
 
 /**
  * A query that allows to explicitly clear both object and list caches either via refetch
- * (eager refresh) or invalidate (lazy refresh). 
+ * (eager refresh) or invalidate (lazy refresh).
  * 
  * @since 3.0
  * @author Andrus Adamchik
@@ -125,15 +125,15 @@
                 QueryMetadata md = query.getMetaData(resolver);
 
                 QueryMetadataWrapper wrappedMd = new QueryMetadataWrapper(md);
-                if (QueryMetadata.LOCAL_CACHE.equals(md.getCachePolicy())) {
+                if (QueryCacheStrategy.LOCAL_CACHE == md.getCacheStrategy()) {
                     wrappedMd.override(
-                            QueryMetadata.CACHE_POLICY_PROPERTY,
-                            QueryMetadata.LOCAL_CACHE_REFRESH);
+                            QueryMetadata.CACHE_STRATEGY_PROPERTY,
+                            QueryCacheStrategy.LOCAL_CACHE_REFRESH);
                 }
-                else if (QueryMetadata.SHARED_CACHE.equals(md.getCachePolicy())) {
+                else if (QueryCacheStrategy.SHARED_CACHE == md.getCacheStrategy()) {
                     wrappedMd.override(
-                            QueryMetadata.CACHE_POLICY_PROPERTY,
-                            QueryMetadata.SHARED_CACHE_REFRESH);
+                            QueryMetadata.CACHE_STRATEGY_PROPERTY,
+                            QueryCacheStrategy.SHARED_CACHE_REFRESH);
                 }
 
                 return wrappedMd;

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/SQLTemplateMetadata.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/SQLTemplateMetadata.java?rev=649265&r1=649264&r2=649265&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/SQLTemplateMetadata.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/SQLTemplateMetadata.java
Thu Apr 17 13:38:06 2008
@@ -48,7 +48,7 @@
         if (super.resolve(root, resolver, null)) {
 
             // generate unique cache key...
-            if (QueryMetadata.NO_CACHE.equals(getCachePolicy())) {
+            if (QueryCacheStrategy.NO_CACHE == getCacheStrategy()) {
 
             }
             else if (query.getName() != null) {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/SelectQueryMetadata.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/SelectQueryMetadata.java?rev=649265&r1=649264&r2=649265&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/SelectQueryMetadata.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/SelectQueryMetadata.java
Thu Apr 17 13:38:06 2008
@@ -32,7 +32,7 @@
         if (super.resolve(root, resolver, null)) {
 
             // generate unique cache key...
-            if (QueryMetadata.NO_CACHE.equals(getCachePolicy())) {
+            if (QueryCacheStrategy.NO_CACHE == getCacheStrategy()) {
 
             }
             else if (query.getName() != null) {
@@ -57,7 +57,7 @@
                 }
 
                 if (!query.getOrderings().isEmpty()) {
-                   for (Ordering o : query.getOrderings()) {
+                    for (Ordering o : query.getOrderings()) {
                         key.append('/').append(o.getSortSpecString());
                         if (!o.isAscending()) {
                             key.append(":d");
@@ -68,8 +68,8 @@
                         }
                     }
                 }
-                
-                if(query.getFetchLimit() > 0) {
+
+                if (query.getFetchLimit() > 0) {
                     key.append('/').append(query.getFetchLimit());
                 }
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/ObjectContextQueryAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/ObjectContextQueryAction.java?rev=649265&r1=649264&r2=649265&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/ObjectContextQueryAction.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/ObjectContextQueryAction.java
Thu Apr 17 13:38:06 2008
@@ -32,6 +32,7 @@
 import org.apache.cayenne.cache.QueryCacheEntryFactory;
 import org.apache.cayenne.query.ObjectIdQuery;
 import org.apache.cayenne.query.Query;
+import org.apache.cayenne.query.QueryCacheStrategy;
 import org.apache.cayenne.query.QueryMetadata;
 import org.apache.cayenne.query.RelationshipQuery;
 import org.apache.cayenne.reflect.ArcProperty;
@@ -258,9 +259,9 @@
             return !DONE;
         }
 
-        boolean cache = QueryMetadata.LOCAL_CACHE.equals(metadata.getCachePolicy());
+        boolean cache = QueryCacheStrategy.LOCAL_CACHE == metadata.getCacheStrategy();
         boolean cacheOrCacheRefresh = cache
-                || QueryMetadata.LOCAL_CACHE_REFRESH.equals(metadata.getCachePolicy());
+                || QueryCacheStrategy.LOCAL_CACHE_REFRESH == metadata.getCacheStrategy();
 
         if (!cacheOrCacheRefresh) {
             return !DONE;

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/EJBQLQueryTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/EJBQLQueryTest.java?rev=649265&r1=649264&r2=649265&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/EJBQLQueryTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/EJBQLQueryTest.java
Thu Apr 17 13:38:06 2008
@@ -74,6 +74,6 @@
         assertFalse(md.isFetchingDataRows());
         assertTrue(md.isRefreshingObjects());
         assertTrue(md.isResolvingInherited());
-        assertEquals(QueryMetadata.NO_CACHE, md.getCachePolicy());
+        assertEquals(QueryCacheStrategy.NO_CACHE, md.getCacheStrategy());
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/ProcedureQueryCacheKeyTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/ProcedureQueryCacheKeyTest.java?rev=649265&r1=649264&r2=649265&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/ProcedureQueryCacheKeyTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/ProcedureQueryCacheKeyTest.java
Thu Apr 17 13:38:06 2008
@@ -31,12 +31,12 @@
         ProcedureQuery query = new ProcedureQuery("ABC", Artist.class);
 
         QueryMetadata md1 = query.getMetaData(resolver);
-        assertEquals(QueryMetadata.NO_CACHE, md1.getCachePolicy());
+        assertEquals(QueryCacheStrategy.NO_CACHE, md1.getCacheStrategy());
         assertNull(md1.getCacheKey());
 
         query.setName("XYZ");
         QueryMetadata md2 = query.getMetaData(resolver);
-        assertEquals(QueryMetadata.NO_CACHE, md2.getCachePolicy());
+        assertEquals(QueryCacheStrategy.NO_CACHE, md2.getCacheStrategy());
         assertNull(md2.getCacheKey());
     }
 
@@ -46,10 +46,10 @@
 
         ProcedureQuery query = new ProcedureQuery("ABC", Artist.class);
 
-        query.setCachePolicy(QueryMetadata.LOCAL_CACHE);
+        query.setCacheStrategy(QueryCacheStrategy.LOCAL_CACHE);
 
         QueryMetadata md1 = query.getMetaData(resolver);
-        assertEquals(QueryMetadata.LOCAL_CACHE, md1.getCachePolicy());
+        assertEquals(QueryCacheStrategy.LOCAL_CACHE, md1.getCacheStrategy());
         assertNotNull(md1.getCacheKey());
     }
 
@@ -59,10 +59,10 @@
 
         ProcedureQuery query = new ProcedureQuery("ABC", Artist.class);
 
-        query.setCachePolicy(QueryMetadata.SHARED_CACHE);
+        query.setCacheStrategy(QueryCacheStrategy.SHARED_CACHE);
 
         QueryMetadata md1 = query.getMetaData(resolver);
-        assertEquals(QueryMetadata.SHARED_CACHE, md1.getCachePolicy());
+        assertEquals(QueryCacheStrategy.SHARED_CACHE, md1.getCacheStrategy());
         assertNotNull(md1.getCacheKey());
     }
 
@@ -72,11 +72,11 @@
 
         ProcedureQuery query = new ProcedureQuery("ABC", Artist.class);
 
-        query.setCachePolicy(QueryMetadata.SHARED_CACHE);
+        query.setCacheStrategy(QueryCacheStrategy.SHARED_CACHE);
         query.setName("XYZ");
 
         QueryMetadata md1 = query.getMetaData(resolver);
-        assertEquals(QueryMetadata.SHARED_CACHE, md1.getCachePolicy());
+        assertEquals(QueryCacheStrategy.SHARED_CACHE, md1.getCacheStrategy());
         assertEquals("XYZ", md1.getCacheKey());
     }
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/SQLTemplateCacheKeyTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/SQLTemplateCacheKeyTest.java?rev=649265&r1=649264&r2=649265&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/SQLTemplateCacheKeyTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/SQLTemplateCacheKeyTest.java
Thu Apr 17 13:38:06 2008
@@ -31,12 +31,12 @@
         SQLTemplate query = new SQLTemplate(Artist.class, "SELECT ME");
 
         QueryMetadata md1 = query.getMetaData(resolver);
-        assertEquals(QueryMetadata.NO_CACHE, md1.getCachePolicy());
+        assertEquals(QueryCacheStrategy.NO_CACHE, md1.getCacheStrategy());
         assertNull(md1.getCacheKey());
 
         query.setName("XYZ");
         QueryMetadata md2 = query.getMetaData(resolver);
-        assertEquals(QueryMetadata.NO_CACHE, md2.getCachePolicy());
+        assertEquals(QueryCacheStrategy.NO_CACHE, md2.getCacheStrategy());
         assertNull(md2.getCacheKey());
     }
 
@@ -46,10 +46,10 @@
 
         SQLTemplate query = new SQLTemplate(Artist.class, "SELECT ME");
 
-        query.setCachePolicy(QueryMetadata.LOCAL_CACHE);
+        query.setCacheStrategy(QueryCacheStrategy.LOCAL_CACHE);
 
         QueryMetadata md1 = query.getMetaData(resolver);
-        assertEquals(QueryMetadata.LOCAL_CACHE, md1.getCachePolicy());
+        assertEquals(QueryCacheStrategy.LOCAL_CACHE, md1.getCacheStrategy());
         assertNotNull(md1.getCacheKey());
     }
 
@@ -59,10 +59,10 @@
 
         SQLTemplate query = new SQLTemplate(Artist.class, "SELECT ME");
 
-        query.setCachePolicy(QueryMetadata.SHARED_CACHE);
+        query.setCacheStrategy(QueryCacheStrategy.SHARED_CACHE);
 
         QueryMetadata md1 = query.getMetaData(resolver);
-        assertEquals(QueryMetadata.SHARED_CACHE, md1.getCachePolicy());
+        assertEquals(QueryCacheStrategy.SHARED_CACHE, md1.getCacheStrategy());
         assertNotNull(md1.getCacheKey());
     }
 
@@ -72,11 +72,11 @@
 
         SQLTemplate query = new SQLTemplate(Artist.class, "SELECT ME");
 
-        query.setCachePolicy(QueryMetadata.SHARED_CACHE);
+        query.setCacheStrategy(QueryCacheStrategy.SHARED_CACHE);
         query.setName("XYZ");
 
         QueryMetadata md1 = query.getMetaData(resolver);
-        assertEquals(QueryMetadata.SHARED_CACHE, md1.getCachePolicy());
+        assertEquals(QueryCacheStrategy.SHARED_CACHE, md1.getCacheStrategy());
         assertEquals("XYZ", md1.getCacheKey());
     }
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/SelectQueryCacheKeyTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/SelectQueryCacheKeyTest.java?rev=649265&r1=649264&r2=649265&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/SelectQueryCacheKeyTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/SelectQueryCacheKeyTest.java
Thu Apr 17 13:38:06 2008
@@ -33,12 +33,12 @@
         SelectQuery query = new SelectQuery(Artist.class);
 
         QueryMetadata md1 = query.getMetaData(resolver);
-        assertEquals(QueryMetadata.NO_CACHE, md1.getCachePolicy());
+        assertEquals(QueryCacheStrategy.NO_CACHE, md1.getCacheStrategy());
         assertNull(md1.getCacheKey());
 
         query.setName("XYZ");
         QueryMetadata md2 = query.getMetaData(resolver);
-        assertEquals(QueryMetadata.NO_CACHE, md2.getCachePolicy());
+        assertEquals(QueryCacheStrategy.NO_CACHE, md2.getCacheStrategy());
         assertNull(md2.getCacheKey());
     }
 
@@ -48,10 +48,10 @@
 
         SelectQuery query = new SelectQuery(Artist.class);
 
-        query.setCachePolicy(QueryMetadata.LOCAL_CACHE);
+        query.setCacheStrategy(QueryCacheStrategy.LOCAL_CACHE);
 
         QueryMetadata md1 = query.getMetaData(resolver);
-        assertEquals(QueryMetadata.LOCAL_CACHE, md1.getCachePolicy());
+        assertEquals(QueryCacheStrategy.LOCAL_CACHE, md1.getCacheStrategy());
         assertNotNull(md1.getCacheKey());
     }
 
@@ -61,10 +61,10 @@
 
         SelectQuery query = new SelectQuery(Artist.class);
 
-        query.setCachePolicy(QueryMetadata.SHARED_CACHE);
+        query.setCacheStrategy(QueryCacheStrategy.SHARED_CACHE);
 
         QueryMetadata md1 = query.getMetaData(resolver);
-        assertEquals(QueryMetadata.SHARED_CACHE, md1.getCachePolicy());
+        assertEquals(QueryCacheStrategy.SHARED_CACHE, md1.getCacheStrategy());
         assertNotNull(md1.getCacheKey());
     }
 
@@ -74,11 +74,11 @@
 
         SelectQuery query = new SelectQuery(Artist.class);
 
-        query.setCachePolicy(QueryMetadata.SHARED_CACHE);
+        query.setCacheStrategy(QueryCacheStrategy.SHARED_CACHE);
         query.setName("XYZ");
 
         QueryMetadata md1 = query.getMetaData(resolver);
-        assertEquals(QueryMetadata.SHARED_CACHE, md1.getCachePolicy());
+        assertEquals(QueryCacheStrategy.SHARED_CACHE, md1.getCacheStrategy());
         assertEquals("XYZ", md1.getCacheKey());
     }
 
@@ -87,13 +87,13 @@
         EntityResolver resolver = getDomain().getEntityResolver();
 
         SelectQuery q1 = new SelectQuery(Artist.class);
-        q1.setCachePolicy(QueryMetadata.LOCAL_CACHE);
+        q1.setCacheStrategy(QueryCacheStrategy.LOCAL_CACHE);
 
         SelectQuery q2 = new SelectQuery(Artist.class);
-        q2.setCachePolicy(QueryMetadata.LOCAL_CACHE);
+        q2.setCacheStrategy(QueryCacheStrategy.LOCAL_CACHE);
 
         SelectQuery q3 = new SelectQuery(Painting.class);
-        q3.setCachePolicy(QueryMetadata.LOCAL_CACHE);
+        q3.setCacheStrategy(QueryCacheStrategy.LOCAL_CACHE);
 
         assertNotNull(q1.getMetaData(resolver).getCacheKey());
         assertEquals(q1.getMetaData(resolver).getCacheKey(), q2
@@ -109,15 +109,15 @@
         EntityResolver resolver = getDomain().getEntityResolver();
 
         SelectQuery q1 = new SelectQuery(Artist.class);
-        q1.setCachePolicy(QueryMetadata.LOCAL_CACHE);
+        q1.setCacheStrategy(QueryCacheStrategy.LOCAL_CACHE);
         q1.setQualifier(ExpressionFactory.matchExp("a", "b"));
 
         SelectQuery q2 = new SelectQuery(Artist.class);
-        q2.setCachePolicy(QueryMetadata.LOCAL_CACHE);
+        q2.setCacheStrategy(QueryCacheStrategy.LOCAL_CACHE);
         q2.setQualifier(ExpressionFactory.matchExp("a", "b"));
 
         SelectQuery q3 = new SelectQuery(Artist.class);
-        q3.setCachePolicy(QueryMetadata.LOCAL_CACHE);
+        q3.setCacheStrategy(QueryCacheStrategy.LOCAL_CACHE);
         q3.setQualifier(ExpressionFactory.matchExp("a", "c"));
 
         assertNotNull(q1.getMetaData(resolver).getCacheKey());
@@ -134,19 +134,19 @@
         EntityResolver resolver = getDomain().getEntityResolver();
 
         SelectQuery q1 = new SelectQuery(Artist.class);
-        q1.setCachePolicy(QueryMetadata.LOCAL_CACHE);
+        q1.setCacheStrategy(QueryCacheStrategy.LOCAL_CACHE);
         q1.setFetchLimit(5);
 
         SelectQuery q2 = new SelectQuery(Artist.class);
-        q2.setCachePolicy(QueryMetadata.LOCAL_CACHE);
+        q2.setCacheStrategy(QueryCacheStrategy.LOCAL_CACHE);
         q2.setFetchLimit(5);
 
         SelectQuery q3 = new SelectQuery(Artist.class);
-        q3.setCachePolicy(QueryMetadata.LOCAL_CACHE);
+        q3.setCacheStrategy(QueryCacheStrategy.LOCAL_CACHE);
         q3.setFetchLimit(6);
 
         SelectQuery q4 = new SelectQuery(Artist.class);
-        q4.setCachePolicy(QueryMetadata.LOCAL_CACHE);
+        q4.setCacheStrategy(QueryCacheStrategy.LOCAL_CACHE);
 
         assertNotNull(q1.getMetaData(resolver).getCacheKey());
         assertEquals(q1.getMetaData(resolver).getCacheKey(), q2



Mime
View raw message